implement semaphore without the use of while or any if statement

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2007
Posts: 2
Reputation: sonu2die4 is an unknown quantity at this point 
Solved Threads: 0
sonu2die4 sonu2die4 is offline Offline
Newbie Poster

implement semaphore without the use of while or any if statement

 
0
  #1
Feb 4th, 2007
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,651
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 474
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: implement semaphore without the use of while or any if statement

 
0
  #2
Feb 4th, 2007
Post your attempt and maybe then we would be able to help you out...
I don't accept change; I don't deserve to live.

Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2
Reputation: sonu2die4 is an unknown quantity at this point 
Solved Threads: 0
sonu2die4 sonu2die4 is offline Offline
Newbie Poster

Re: implement semaphore without the use of while or any if statement

 
0
  #3
Feb 4th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,662
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1501
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: implement semaphore without the use of while or any if statement

 
0
  #4
Feb 5th, 2007
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 2279 | Replies: 3
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC