The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
pthread condition variables and mutexes? siddaonline UNIX for Dummies Questions & Answers 2 08-30-2008 11:47 AM
How many semaphores? Watto86 UNIX for Advanced & Expert Users 8 11-07-2007 10:32 PM
Need to execute 2 scripts, wait, execute 2 more wait, till end of file halo98 Shell Programming and Scripting 1 08-01-2006 01:42 PM
Howto spawn multiple child processes and wait? siegfried High Level Programming 4 10-16-2005 10:21 PM
C++ variable scope and mutexes Corona688 High Level Programming 0 10-05-2005 10:29 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 08-05-2006
Registered User
 

Join Date: Oct 2005
Posts: 86
How to wait on multiple semaphores/mutexes

I thought one used the select function to wait on multiple semaphores but according to http://opengroup.org/onlinepubs/0079...sh/select.html, the select function is only good for I/O features (like pipes and fifos).

How can I block for multiple semaphores? What if I have a mixture of things to wait on like semaphores from sem.h, semaphores from semaphore.h and mutexes? Am I out of luck?


Thanks,
Siegfried
Reply With Quote
Forum Sponsor
  #2  
Old 08-06-2006
Hitori's Avatar
Registered User
 

Join Date: Jun 2006
Posts: 360
Use pthread_mutex_timedlock(), sem_trywait() (in conjunction with sleep()) functions in a cycle and continue executing when all mutexes/semaphores are blocked by your thread.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 07:32 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0