954,135 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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

sonu2die4
Newbie Poster
2 posts since Feb 2007
Reputation Points: 10
Solved Threads: 0
 

Post your attempt and maybe then we would be able to help you out...

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 733
 

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

sonu2die4
Newbie Poster
2 posts since Feb 2007
Reputation Points: 10
Solved Threads: 0
 

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.

Ancient Dragon
Retired & Loving It
Team Colleague
30,040 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,341
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You