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

Reply via email to