From owner-freebsd-threads@FreeBSD.ORG Sat Feb 5 07:24:56 2011 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id C4FED106566B; Sat, 5 Feb 2011 07:24:55 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-threads@freebsd.org Date: Sat, 5 Feb 2011 02:24:09 -0500 User-Agent: KMail/1.6.2 References: <201102041409.12314.jkim@FreeBSD.org> <20110204213302.GS78089@deviant.kiev.zoral.com.ua> In-Reply-To: <20110204213302.GS78089@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201102050224.23377.jkim@FreeBSD.org> Cc: davidxu@freebsd.org Subject: Re: [RFC] Implement pthread_getthreadid_np(3) and pthread_getunique_np(3) 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: Sat, 05 Feb 2011 07:24:56 -0000 On Friday 04 February 2011 04:33 pm, Kostik Belousov wrote: > On Fri, Feb 04, 2011 at 02:09:10PM -0500, Jung-uk Kim wrote: > > Our pthread_t is not an integral type and it causes a lot of > > trouble porting some software, which relies on Linux's gettid() > > or similar syscalls: > > > > http://www.kernel.org/doc/man-pages/online/pages/man2/gettid.2.ht > >ml > > > > For example: > > > > http://docs.freebsd.org/cgi/mid.cgi?201102032111.13479.jkim > > > > To solve this problem, I implemented two functions: > > > > http://people.freebsd.org/~jkim/thr_tid.diff > > > > Basically, they are AIX's pthread_getthreadid_np(3) and > > pthread_getunique_np(3) look-alikes: > > > > http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/apis/ > >users_22.htm > > http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/apis/ > >users_23.htm > > > > Please let me know what you think. > > Why do you need new functions available in stubs ? Oops, my bad. Fixed: http://people.freebsd.org/~jkim/thr_tid2.diff > Also, would it be better to return proper id even if threading is > not initialized, instead of EINVAL ? Because I want it to be fast and cause no side-effect, no. Jung-uk Kim