From owner-freebsd-threads@FreeBSD.ORG Mon Dec 28 07:18:19 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCE5F1065672; Mon, 28 Dec 2009 07:18:19 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B164D8FC1D; Mon, 28 Dec 2009 07:18:19 +0000 (UTC) Received: from apple.my.domain (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nBS7IHon042544; Mon, 28 Dec 2009 07:18:18 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4B385BB9.3010109@freebsd.org> Date: Mon, 28 Dec 2009 15:18:17 +0800 From: David Xu User-Agent: Thunderbird 2.0.0.9 (X11/20080612) MIME-Version: 1.0 To: John Baldwin References: <4B317741.8080004@freebsd.org> <4B32CADA.4010407@freebsd.org> <20091223221219.4416cef6@kan.dnsalias.net> <200912240759.47703.jhb@freebsd.org> In-Reply-To: <200912240759.47703.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: Daniel Eischen , freebsd-threads@freebsd.org Subject: Re: first patch for process-shared semaphore X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 07:18:19 -0000 John Baldwin wrote: > On Wednesday 23 December 2009 10:12:19 pm Alexander Kabaev wrote: >> On Thu, 24 Dec 2009 09:58:50 +0800 >> David Xu wrote: >> >>> Alexander Kabaev wrote: >>>> On Thu, 24 Dec 2009 09:22:34 +0800 >>>> David Xu wrote: >>>>> libthr does not require semaphore, it implements semaphore, >>>>> it is easier than other ways to implement the process-shared. >>>>> >>>> Let me rephrase: I do not think semaphores belong in libthr. They >>>> should be either in libc or in librt. >>>> >>>> >>> OK, does others really implement semaphore in librt ? >>> unfortunately, the librt already requires libpthread to implement >>> SIGEV_THREAD. >> I retract that. It appears that there is no consistency - Solaris put >> these into libc, Linux into libpthread ans SUSv2 hints that these >> belong with realtime functions. libthr is fine. > > I vote for libc. Single-threaded processes can use sem_open() and PSHARED > sem_init() as well. Single-threaded processes can even use non-PSHARED > sem_init() by using fork() to create new "threads" that share the semaphore. > May I can move all semaphore functions into libc and remove all semaphore related symbols from libthr ? In pratical, this is not a problem, because libthr itself is not dlopen-safe, all missing semaphore functions in libthr will be found in libc by rtld.