587 Subj : Re: I write a multithread program with pthread, and meet a program To : comp.programming.threads From : Giancarlo Niccolai Date : Mon Apr 18 2005 11:42 am Loic Domaigne wrote: > Hello, > >> But I am still surprised that the new thread can not be stopped >> correctly. > > You still didn't told us which Pthreads implementation you are using. > LinuxThreads or NPTL? > > Does the effect subsists when doing the following export before running > the program? > bash$ export LD_ASSUME_KERNEL=2.4.19 > >> cout may be a cancellation point or not. >> Theoritically, if cout is not a cancellation point, the new thread will >> continue to run when the main thread call pthread_cancel(); if it is >> cancellation point, the new thread will be stopped. >> But as a matter of fact, the new thread does not run and is not >> stopped. In linux, the new thread will be a zombie. >> What I want to know is why. > > It's only a theory at that point... But it looks like a bug in the > libstdc++ or the libpthread, when a thread is being cancelled while > writting on cout. > Uhm, AFAIK write() system call is a cancellation point, and cout << is supposed to write somewhere. So it *ought* to be a cancellation point unless posix or c++ standards states otherwise. There is not any statement in this sense to may knowledge, but I may be outdated... Giancarlo Niccolai. . 0