Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Aug 2007 19:19:17 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Scott Long <scottl@samsco.org>
Cc:        wine-freebsd@hub.org, Kris Moore <krismoore@comcast.net>, src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org, Daniel Eischen <deischen@FreeBSD.org>, David Xu <davidxu@FreeBSD.org>, Tijl Coosemans <tijl@ulyssis.org>, Xin LI <delphij@delphij.net>
Subject:   Re: cvs commit: src/sys/kern kern_thr.c syscalls.master src/sys/sys
Message-ID:  <20070819191731.N81759@fledge.watson.org>
In-Reply-To: <20070819185019.M81759@fledge.watson.org>
References:  <200708160526.l7G5Qg0b008022@repoman.freebsd.org> <46C4FD02.3090708@freebsd.org> <Pine.GSO.4.64.0708162216530.1396@sea.ntplx.net> <200708182118.37998.tijl@ulyssis.org> <20070818204223.D1234@fledge.watson.org> <Pine.GSO.4.64.0708182050070.13363@sea.ntplx.net> <46C7A9A4.5090404@samsco.org> <20070819095302.D66918@fledge.watson.org> <46C863C5.6090906@comcast.net> <46C86D9A.9050705@samsco.org> <20070819185019.M81759@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 19 Aug 2007, Robert Watson wrote:

> I think the misunderstanding here is in thinking that Wine is an application 
> that can program to the pthreads API and behave in a normal way.  Instead, 
> think of it as including its own threads library implementing Windows 
> threading behavior.  On the whole, the existing thread calls meet the needs 
> of Wine, and often it can access them via pthreads, but there are times when 
> it needs to *know* how threading works, and in those cases, accessing 
> threads via low-level system call like thr_kill2(2) or via ptrace(2) may be 
> entirely appropriate.
>
> Tijl's example of having aligned thread IDs for use between ptrace(2) and 
> the thr_*(2) system calls is a particularly good example of a case where the 
> clean pthreads abstraction (which has no notion of how to interact with 
> debuggers) isn't a good match.  We have a plethora of low level threads 
> system calls that applications generally shouldn't touch -- rfork(2), 
> kse_*(2), thr_*(2), umtx_*(2), etc.  Last time I checked, Valgrind on 
> FreeBSD did something very similar, relying on low-level umtx(2) system 
> calls.

Just to follow up on this point: as with the other kse(2), thr(2), umtx(2), 
etc, interfaces, I think we should heavily discourage programmers from using 
them -- they are internal interfaces used to implement threading, and not 
general purpose application programming interfaces.  I think adding a 
libpthread-layer interface for killing threads in other processes would be a 
mistake for all the reasons that Daniel and others have pointed out.

Robert N M Watson
Computer Laboratory
University of Cambridge



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070819191731.N81759>