DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C (http://www.daniweb.com/forums/forum118.html)
-   -   implement semaphore without the use of while or any if statement (http://www.daniweb.com/forums/thread69150.html)

sonu2die4 Feb 4th, 2007 10:10 pm
implement semaphore without the use of while or any if statement
 
Hello,
I want to know how to implement semaphore without the use of while or any if statement
The Problem is
Thread A , B , C they all want to output the result at the same time
A wants ot print 'A'
B wants to print 'B'
C wants to print 'C'
the output must be 'ABC'. I do not know how to do this.Please help me with the same
Regards
Sonu

~s.o.s~ Feb 4th, 2007 10:41 pm
Re: implement semaphore without the use of while or any if statement
 
Post your attempt and maybe then we would be able to help you out...

sonu2die4 Feb 4th, 2007 10:50 pm
Re: implement semaphore without the use of while or any if statement
 
actually i am a newbie to semaphore so i cannot even think about it. I know i sound a bit too wierd but im messed up with it...i have seen a lot of codes but i really have not seen practical implemention of that ....so wanted to test with the abouve snippet
Regards
Sonu

Ancient Dragon Feb 5th, 2007 12:18 am
Re: implement semaphore without the use of while or any if statement
 
Here is information you need. After creating a semaphore your program calls one of the wait functions to gain access to it. When the ReleaseSemaphore() is canned another thread that is waiting will be released.


All times are GMT -4. The time now is 2:26 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC