487 Subj : Re: Boss Told Me You Can't Use Semaphore, But I Have To Do To : comp.programming.threads From : Dragan Cvetkovic Date : Wed Jul 13 2005 05:34 pm Chris Friesen writes: > David Schwartz wrote: > >> Semaphores were originally designed to be process-shared and do this >> in a natural way. Mutexes were originally designed to be process-local, >> and have process-shared support hacked on. For example, to create a >> semaphore, you just call the semaphore create function. To create a >> process-shared mutex, you have to allocate shared memory and then put the >> mutex in it. > > With semas, you have something like: > > semget() -- creation > semctl() -- initialization > semop() -- lock > semop() -- unlock Don't forget POSIX semaphores: sem_open(), sem_post(), sem_wait(), sem_close(), sem_unlink(). They should be able to work both between threads and between processes, but not all OSes support them fully. Dragan -- Dragan Cvetkovic, To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer !!! Sender/From address is bogus. Use reply-to one !!! . 0