Brian Smith wrote:
> >Sure SysV semaphores are thread-safe.  When a thread blocks on
> >one, the entire process blocks (no threads run).  You won't
> >get any safer than that ;-)
> 
> Yikes that isn't good.  Is that only in STABLE?  or does CURRENT
> do that as well?  I guess I'll have to protect the semop() call
> with a pthread mutex to prevent two threads locking a single
> semaphore by the same process (creating a deadlock situation).
> 
> Is this the recommended method of preventing these problems?

Yeah: don't make blocking system calls for which there are no
asynchronous equivalents.  Use the POSIX interfaces for use
by pthreads, instead.


> (the SysV semaphore is protecting shared memory accessed by
> multiple processes).
> 
> Thanks for the info... it explains alot!

Use mmap of a backing-store file, and then use file locking to
do record locking in the shared memory segment.

-- Terry

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to