Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Borland Delphi > Semaphores in D...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 3736 of 3850
Post > Topic >>

Semaphores in Delphi

by Locke <jlocke@[EMAIL PROTECTED] > May 6, 2008 at 12:17 AM

I'm trying to implement a simple semaphore to protect critical sections 
of code with the following procedures.

Question is are these safe, or is it possible that 2 threads could slip 
through EnterCritical at the same time?

Thanks

procedure EnterCritical;
begin
   while semaphore do sleep(30);
   semaphore:=true;
end;

procedure ExitCritical;
begin
   semaphore:=false;
end;
 




 4 Posts in Topic:
Semaphores in Delphi
Locke <jlocke@[EMAIL P  2008-05-06 00:17:40 
Re: Semaphores in Delphi
Jamie <jamie_ka1lpa_no  2008-05-05 19:43:28 
Re: Semaphores in Delphi
Rob Kennedy <me3@[EMAI  2008-05-05 19:19:17 
Re: Semaphores in Delphi
Locke <jlocke@[EMAIL P  2008-05-06 01:27:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 23 21:32:46 CDT 2008.