![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| How many semaphores? | Watto86 | UNIX for Advanced & Expert Users | 8 | 11-08-2007 01:32 AM |
| semaphores using up and down | ddx08 | High Level Programming | 7 | 04-03-2007 11:38 PM |
| semaphores | kekanap | Shell Programming and Scripting | 1 | 03-27-2007 06:56 AM |
| Semaphores with key of 0 | doeboy | UNIX for Advanced & Expert Users | 0 | 10-28-2004 04:41 PM |
| Semaphores | joseph_shibu | High Level Programming | 1 | 11-01-2001 01:01 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
semaphores
Hi there,
Could someone please confirm which POSIX semaphore routines should be used for a multiprocess (and not multithreaded) environment? sys/sem.h definitely works. but the routines, semget, semctl, semop are pretty unwieldy. So, I am looking for an easier way out. From the man pages it also appears that routines in semaphore.h should work for multiprocesses. #include <semaphore.h> int sem_init(sem_t *sem, int pshared, unsigned int value); The man pages say: "If the pshared argument has a non-zero value, then the semaphore is shared between processes; in this case, any process that can access the semaphore sem can use sem for performing sem_wait(), sem_trywait(), sem_post(), and sem_destroy() operations." However, the I am not able to achieve mutual exclusion with this. There are no compilation or runtime errors. The danm thing just doesn't work. Could somebody take a guess what I might be doing wrong? regards, Quantum Teleporter |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|