Re: How to kill a thread?
Re: How to kill a thread?
- Subject: Re: How to kill a thread?
- From: Daryn <email@hidden>
- Date: Sun, 19 Jan 2003 15:33:49 -0600
On Sunday, January 19, 2003, at 03:50 PM, Mark Levin wrote:
And pthreads can be used safely in Obj-C apps.
...aside from the warning in the documentation that the cocoa
libraries will not become thread-safe unless you use NSThreads?
It would be trivial to spin off a NSThread that simply exits, per the
following documentation:
"To use Cocoa from multiple threads, the Cocoa framework must be put
into multithreading mode, which activates greater thread safety
measures. This happens automatically when the first NSThread is
detached. If you use the POSIX thread APIs to create threads, your
application must detach at least one NSThread, which may immediately
exit, before any pthreads can use Cocoa."
I'd be curious if this really relates to the Cocoa vs obj-C, since Greg
Parker (Apple employee) once said on this list:
"In Mac OS X, the Objective-C runtime no longer has "thread-unsafe" and
"thread-safe" modes. The runtime always operates thread-safely, and
objc_setMultithreaded() is a no-op. (A clever synchronization system
allows cached messages to be sent with zero locking overhead, even with
multiple threads or CPUs around. Nearly all messages sent are already
cached, so thread-safe mode is usually no more expensive than thread-
unsafe mode would be.)"
Daryn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.