Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Nov 2002 22:31:28 -0600
From:      "Brian Smith" <dbsoft@technologist.com>
To:        "Daniel Eischen" <eischen@pcnet1.pcnet.com>
Cc:        "current@freebsd.org" <current@FreeBSD.ORG>
Subject:   Re: Are SysV semaphores thread-safe on CURRENT?
Message-ID:  <20021119043130.WWGB397.mail1-0.chcgil.ameritech.net@bbs>
In-Reply-To: <Pine.GSO.4.10.10211182130110.12758-100000@pcnet1.pcnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 18 Nov 2002 21:33:38 -0500 (EST), Daniel Eischen wrote:

>[ I assume you mean semop, semctl, not sema_* or sem_* ]

Yes ... semop() specifically is causing the problems...

>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?

(the SysV semaphore is protecting shared memory accessed by
multiple processes).

Thanks for the info... it explains alot!

Brian Smith




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021119043130.WWGB397.mail1-0.chcgil.ameritech.net>