Alan,

If you mean to make a TCF that is thread safe, it depends on why you
need it thread safe. Normally just using the method scope for all action
internal to the TCF is enough, however if you need to deal with external
dependencies, ie writing to two different log files in tandem, then you
need to use a higher scope, such as instance, or domain to record your
busy flag. Since I have more than one server, I can only depend on my
database as a single point of reference, and therefore set and release a
flag in my database to solve certain overrun problems. Make sure to
alert yourself or log when contention occurs since it can become a
problem can cause congestion if it goes wrong.

Robert

-----Original Message-----
From: Alan Wolfe [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 01, 2004 12:42 PM
To: [EMAIL PROTECTED]
Subject: Re: Witango-Talk: Thread Safe Class file

hey Bill, correct me if im wrong but wouldnt this work too?  I just like
this method because it waits until the other thread is done, so you dont
have to have code to recheck if it's busy.

while (user$active != 0)
{
  (doing nothing...)
}

user$active = 1;

do the stuff

user$active = 0;

----- Original Message ----- 
From: "Bill Conlon" <[EMAIL PROTECTED]>
To: "Witango-Talk" <[EMAIL PROTECTED]>
Sent: Monday, March 01, 2004 9:11 AM
Subject: Re: Witango-Talk: Thread Safe Class file


> Here's pseudo code to handle critical sections:
>
> if (user$active>0)
>      error return, "sorry, you have a request pending, try again"
> else
>      user$active=user$active+1
> if  (user$active=1)
>      process stuff
> else
>      error return:  "sorry a thread inserted itself between the first
> error check and the processing check"
> endif
> user$active=user$active-1
> good return
>
>
>
> >Where would I look to find out how to create a "thread safe" class
file?
> >
> >Steve Fogelson
> >Internet Commerce Solutions
>
>_______________________________________________________________________
_
> >TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
> >
>
>
> 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: Go to http://www.witango.com/developer/maillist.taf

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to