From owner-freebsd-current Mon Nov 18 20:31:39 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6FE2537B401 for ; Mon, 18 Nov 2002 20:31:38 -0800 (PST) Received: from mail1-0.chcgil.ameritech.net (mail1-0.chcgil.ameritech.net [206.141.192.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id B06E843E77 for ; Mon, 18 Nov 2002 20:31:37 -0800 (PST) (envelope-from dbsoft@technologist.com) Received: from bbs ([67.39.182.225]) by mail1-0.chcgil.ameritech.net (InterMail vM.4.01.02.17 201-229-119) with ESMTP id <20021119043130.WWGB397.mail1-0.chcgil.ameritech.net@bbs>; Mon, 18 Nov 2002 22:31:30 -0600 From: "Brian Smith" To: "Daniel Eischen" Cc: "current@freebsd.org" Date: Mon, 18 Nov 2002 22:31:28 -0600 X-Mailer: PMMail 2000 Standard (2.20.2661) For Windows 2000 (5.1.2600) In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Subject: Re: Are SysV semaphores thread-safe on CURRENT? Message-Id: <20021119043130.WWGB397.mail1-0.chcgil.ameritech.net@bbs> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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