Using a Semaphore in Reentrant function

Thread Solved

Join Date: May 2007
Posts: 9
Reputation: venuaccha is an unknown quantity at this point 
Solved Threads: 0
venuaccha venuaccha is offline Offline
Newbie Poster

Using a Semaphore in Reentrant function

 
0
  #1
May 22nd, 2007
Can anyone tell me whether it is allowed to use a Semaphore in a Reentrant function.
Reply With Quote Quick reply to this message  
Join Date: May 2004
Posts: 178
Reputation: jim mcnamara is on a distinguished road 
Solved Threads: 10
jim mcnamara jim mcnamara is offline Offline
Junior Poster

Re: Using a Semaphore in Reentrant function

 
0
  #2
May 22nd, 2007
Do you mean 'will the compiler complain' - no.
'Is it a good idea' - Again, probably not.

Reentrant functions should have all of their data passed to them as arguments, and not use global data structures. Semaphores are traffic cops for access to global objects or shared objects.

This sounds like a threads design problem. What are you trying to do?
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 9
Reputation: venuaccha is an unknown quantity at this point 
Solved Threads: 0
venuaccha venuaccha is offline Offline
Newbie Poster

Re: Using a Semaphore in Reentrant function

 
0
  #3
May 22nd, 2007
I got the answer from below link.
http://www.unet.univie.ac.at/aix/aix...m#o8Nfj357manu



Originally Posted by jim mcnamara View Post
Do you mean 'will the compiler complain' - no.
'Is it a good idea' - Again, probably not.

Reentrant functions should have all of their data passed to them as arguments, and not use global data structures. Semaphores are traffic cops for access to global objects or shared objects.

This sounds like a threads design problem. What are you trying to do?
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC