On Jul 6, 2004, at 7:59 AM, Christoph Ndgeli wrote:
Is there any documentation about the Mach Thread API?
Yes, in the xnu source tree (download from Darwin) at xnu/osfmk/man/index.html
There are no man pages for the functions nor is there something in the
documentation
that came with the developer tools nor are the header files
documentated.
The header files are MIG generated. But we normally ship the .defs IDL files which at least has some information (<mach/thread_act.defs>).
I need to kill a thread immediatly and as far as I can see, there is
no way to do it with posix threads
=> I thought it would be pthread_cancel but that doesn't seem to work.
The pthread_cancel() routine only interrupts a thread at a known clean point. POSIX defines many clean points, but only one is currently implemented in Mac OS X/Darwin (pthread_testcancel()). The reason is that the others are called throughout the upper layer frameworks of Mac OS X, but they do not implement cancellation safely logic yet...so it would be very unsafe to allow them in most Mac OS X applications. We are working on a way for pure POSIX applications to get the correct behavior while protecting Mac OS X-specific applications until the frameworks protect themselves. Stay tuned... Using Mach APIs directly to undermine the POSIX libraries is a good way to lead to memory leakage, corruption, and or crashes. In particular, there is no good way to use the Mach thread termination APIs without confusing the pthread layer. What is the thread doing when you want to kill it? If it is looping, can you add a call to pthread_testcancel()? If not, can you take a directed signal (pthread_kill()) and convert that into something you check for clean termination (after releasing locks, etc... held by the target thread). --Jim [demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s] _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.