Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Where are semaphores in POSIX threads?

POSIX semaphores threads
0
Posted

Where are semaphores in POSIX threads?

0

David McCann wrote: > Jan Pechanec wrote: > > > > Hello, > > > > I have a summary of POSIX papers on threads, but there in no > > imformation about semaphores (just conditional vars, mutexes). *NO* > > pthread_semaphoreinit() etc. > > > > In some materials, there is information on sem_wait(), sem_send() (or > > sm. like that), but is it for threads (or just processes)? > > I think this whole discussion has digressed from Jan’s original question > above. Yes, there are sem_* calls in Solaris 2.5 (and 2.4 IIRC); you > just need to link with -lposix4 or whatever to get them. But these are the > *POSIX.1b* semaphores, which are *process-based* semaphores. They have > nothing to do with threads. > > Now what Jan wants here is semaphore calls for *POSIX.1c*, i.e. POSIX > threads. Now, IIRC, the sem_* calls are NOT specified in POSIX.1c, but > rather their behaviour in MT programs has been clarified/refined in XPG5 > (Unix98) which allows you to use semaphores to synchronize threads and/or >

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123