It seems to me the issue is whether an action is atomic (kind of like a
transaction). Similar to other critical code sections that can't be
interrupted.
So some kind of semaphore needs to be used on the server (e.g.
user$active) and associated with a user's state variables on the client,
for example: userreferenceargument.
So each critical taf begins:
if (user$active)
return a page saying, "sorry, you have a request pending, try again"
else
set user$active
endif
process stuff
clear user$active
return
Now at least any variables changed by the taf are complete and consistent
(assuming the underlying taf is properly written).
So this of course requires that the if--else structure is atomic, and if
we were writing a device driver, we would turn off interrupts. I'm not
aware of any mechanism in wiTango to assure this, so it is still
conceiveable that two requests could both set user$active (particularly
with a concurrent thread environment).
So the next piece of protection is to increment/decrement user$active
instead of just set/clear.
Now we do:
if (user$active=0)
return a page saying, "sorry, you have a request pending, try again"
else
user$active=user$active+1
if (user$active=1)
process stuff
else
abort this transaction.
endif
user$active=user$active-1
return
So we can abort if some other thread has insuated itself. To be extra
safe, just before the return, we should verify that user$active=0. If
not, dump everything to the log and email the programmer!
>I can agree with that statement. I've found this to be the case the hard
>way. I have a control panel script that has a bunch of forms on it that
>consist of submit buttons that toggle a control on or off (0 or 1) and
>based on that setting I will update vars of different scopes. Some of
>these buttons are dependant upon their a variable in some scope being set.
>What I have done is built a set of what I call require which are small
>tafs that check to see if the variables in a specific scope are still
>valid. This is usually like the 1 or second action in all my tafs. I call
>it using a branch and return from branch function. this is really just and
>an if else decision tree checking the variables in some prescribed
>hierarchy I usually start at the top with Server, application, and Domain
>scope and then move down through the User and Local vars. If any of these
>vars are proven to be invalid I reload the variable in question from the
>db with a dbms call to the table where that variable is stored. and then
>continue through the tree. This is tricky with locals as most of the time
>locals are generated consumed and destroyed too fast to make a difference
>or are not generated by some db setting so in that case too bad, soo sad.
>But what this provides is a first line of defense to the "unpredictable"
>results that Robert alluded to by forcing the taf to decide if all the
>vars are still valid before getting to the page.
>csmith
>
>----- Original Message -----
> From: Robert S. Sfeir
> To: Multiple recipients of list witango-talk
> Sent: Tuesday, September 24, 2002 7:43 PM
> Subject: Re: Witango-Talk: a random question
>
>
> This depends on how far down the taf the app server went, so you might
>get some of it, and it might ignore some. In other words it's not going
>to be pretty if you're counting on specific vars to be set before button 2
>gets clicked because the results will be unpredictable.
>
> R
> ----- Original Message -----
> From: Alan Wolfe
> To: Multiple recipients of list witango-talk
> Sent: Tuesday, September 24, 2002 7:42 PM
> Subject: Witango-Talk: a random question
>
>
> hello, this kind of trivial but i was wondering what happens w/ tango
>if i as a user click a button on a form so it submits that form but before
>the page it brings up can load i click a different button. If the first
>one changes user scope vars and such, will they be changed when the second
>button's page is loaded?
>
Bill Conlon
To the Point
345 California Avenue Suite 2
Palo Alto, CA 94306
office: 650.327.2175
fax: 650.329.8335
mobile: 650.906.9929
e-mail: mailto:[EMAIL PROTECTED]
web: http://www.tothept.com
________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
with unsubscribe witango-talk in the message body