943,754 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 3664
  • C RSS
Feb 4th, 2007
0

implement semaphore without the use of while or any if statement

Expand Post »
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
Last edited by sonu2die4; Feb 4th, 2007 at 10:12 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sonu2die4 is offline Offline
2 posts
since Feb 2007
Feb 4th, 2007
0

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...
Super Moderator
Featured Poster
Reputation Points: 3233
Solved Threads: 719
Failure as a human
~s.o.s~ is offline Offline
8,871 posts
since Jun 2006
Feb 4th, 2007
0

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sonu2die4 is offline Offline
2 posts
since Feb 2007
Feb 5th, 2007
0

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: c coding on linux
Next Thread in C Forum Timeline: Checking if the socket is valid in C





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC