From owner-freebsd-current Mon Nov 18 21: 1:26 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 868C037B401 for ; Mon, 18 Nov 2002 21:01:25 -0800 (PST) Received: from khavrinen.lcs.mit.edu (khavrinen.lcs.mit.edu [18.24.4.193]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B36743E9C for ; Mon, 18 Nov 2002 21:01:24 -0800 (PST) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: from khavrinen.lcs.mit.edu (localhost [IPv6:::1]) by khavrinen.lcs.mit.edu (8.12.3/8.12.5) with ESMTP id gAJ51Nen019865 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Tue, 19 Nov 2002 00:01:23 -0500 (EST) (envelope-from wollman@khavrinen.lcs.mit.edu) Received: (from wollman@localhost) by khavrinen.lcs.mit.edu (8.12.3/8.12.5/Submit) id gAJ51KFZ019862; Tue, 19 Nov 2002 00:01:20 -0500 (EST) (envelope-from wollman) Date: Tue, 19 Nov 2002 00:01:20 -0500 (EST) From: Garrett Wollman Message-Id: <200211190501.gAJ51KFZ019862@khavrinen.lcs.mit.edu> To: "Brian Smith" Cc: "current@freebsd.org" Subject: Re: Are SysV semaphores thread-safe on CURRENT? In-Reply-To: <20021119043130.WWGB397.mail1-0.chcgil.ameritech.net@bbs> References: <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 < said: > Is this the recommended method of preventing these problems? The recommended method of preventing these problems generally is to use POSIX semaphores (or other POSIX synchronization mechanisms appropriate to threaded programs. However, the code to implement process-shared POSIX semaphores is still experimental. The problem with System V semaphores is that there is no way to poll their status while still polling the process's file descriptors. This could be fixed by introducing a new kqueue filter, but the semantics of System V semaphores are difficult to emulate. Depending on the semantics you require, a semaphore may be implemented using a pipe or fifo, or by using file or record locking. -GAWollman To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message