summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Action.cc23
1 files changed, 10 insertions, 13 deletions
diff --git a/lib/Action.cc b/lib/Action.cc
index 33b0b36..7cffc70 100644
--- a/lib/Action.cc
+++ b/lib/Action.cc
@@ -23,7 +23,6 @@
#include "BString.h"
#include "Action.h"
#include "HttpServ.h"
-#include "Atomic.h"
Action * Action::start = 0;
@@ -41,24 +40,29 @@ static String genurl(const String & u) {
}
Action::Action(const String & u, HtmlSkinner * _skin) : next(start), prev(0), URL(genurl(u)), hastoclean(false), accessed(false), skin(_skin) {
+ lock.lock();
start = this;
if (next) next->prev = this;
+ lock.unlock();
if (!skin) {
skin = &default_skinner;
}
}
Action::~Action() {
+ lock.lock();
if (start == this) {
start = next;
}
if (next) next->prev = prev;
if (prev) prev->next = next;
+ lock.unlock();
}
Action * Action::Look4URL(const String & URL) {
Action * p;
+ lock.lock();
// cerr << "Looking for " << URL << endl;
for (p = start; p; p = p->next) {
// cerr << "p->GetURL() = " << p->GetURL() << endl;
@@ -68,9 +72,13 @@ Action * Action::Look4URL(const String & URL) {
// était déclarée en mode CleanUp, puis a été accédée.
delete p;
} else {
- if (URL == p->GetURL()) return p;
+ if (URL == p->GetURL()) {
+ return p;
+ lock.unlock();
+ }
}
}
+ lock.unlock();
return 0;
}
@@ -88,23 +96,12 @@ void Action::SendFoot(Handle * h) {
(*h) << skin->Footer();
}
-HtmlSkinner * Action::GetSkinner() {
- return skin;
-}
-
String Action::GetURL(void) {
// Comme décrit plus haut, il faut renvoyer la chaîne vide si l'action est en
// mode CleanUp et a été lue.
return (hastoclean && accessed) ? "" : URL;
}
-void Action::CleanUp(void) {
- hastoclean = true;
-}
-
-void Action::Accessed(void) {
- accessed = true;
-}
void Action::ShowButton(Handle * h, const String & l, const String & u) {
(*h) << "<CENTER><FORM METHOD=\"POST\" ACTION=\"/bin/" << u << "\">" << endnl <<