User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 456,420 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,623 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums
Views: 1278 | Replies: 3
Reply
Join Date: Feb 2007
Posts: 2
Reputation: sonu2die4 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sonu2die4 sonu2die4 is offline Offline
Newbie Poster

implement semaphore without the use of while or any if statement

  #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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 7,012
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 25
Solved Threads: 368
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

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

  #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.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Join Date: Feb 2007
Posts: 2
Reputation: sonu2die4 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
sonu2die4 sonu2die4 is offline Offline
Newbie Poster

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

  #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  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,541
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 40
Solved Threads: 972
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Most Valuable Poster

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

  #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.
<<Freelance Programmer>> << Hobby Site>>
Signature links for sale. PM me for details
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C Forum

All times are GMT -4. The time now is 1:04 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC