Messages in this thread | | | Date | Fri, 16 Aug 2002 12:02:00 +0200 (CEST) | From | Ingo Molnar <> | Subject | Re: [patch] user-vm-unlock-2.5.31-A2 |
| |
On Fri, 16 Aug 2002, Jamie Lokier wrote:
> > like i said in the original email, the point of CLONE_DETACHED is to avoid > > the waitpid() overhead. I also said that exit notification is done via > > mutexes (futexes). > > How? Scenario: > > 1. a thread calls a 3rd party library which was _not_ compiled with > threading in mind. (It shouldn't have to be). > > 2. 3rd party library sends itself a SIGABRT; perhaps an assertion > failed. (Variants: SIGFPE, library does execve(), etc.) > > 3. thread exits.... but the mutex was _not_ released
this is a simple and well-defined thing: if the thread exits by calling the exit() function then libc calls the exit_thread_group() syscall [part of my POSIX signals patch] and zaps all threads. This is a very clearly defined thing in POSIX.
SIGABRT/SIGFPE if uncaught cause a segmentation fault that zaps all threads (the kernel does this zapping). [note that for this you'll have to use the POSIX signals patch i mentioned earlier.]
> 4. I _want_ to report the death to other thread, without having > to poll all my children in my main event loop.
POSIX says that in this case (when eg. non-threaded POSIX code calls exit()) all threads must exit and a status code is sent to the parent of the threaded application. And this is precisely how it works.
> This is a very legitimate and useful kind of thread death, and it's > perfectly safe too. (Not pthreads-conformant, but clone() is useful for > more than just pthreads).
as long as you are using libc there are certain POSIX rules that must be followed. NGPT has to do the same.
non-POSIX programming methods like JVMs can still implement *any* semantics - but your whole example is based on POSIX issues like exit() or default signal handlers, not Java.
Ingo
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |