Re: Follow-up: Cocoa thread-safety
Re: Follow-up: Cocoa thread-safety
- Subject: Re: Follow-up: Cocoa thread-safety
- From: Nicholas Riley <email@hidden>
- Date: Sat, 26 Oct 2002 00:39:11 -0500
- Mail-followup-to: Steve Klingsporn <email@hidden>, email@hidden
On Fri, Oct 25, 2002 at 11:07:03PM -0500, Steve Klingsporn wrote:
>
Unfortunately, NSThread is not available from Java, nor do these
>
methods seem to be relocated as the Java counterparts often are. I
>
suppose it might be possible to write some code that uses JNI or the
>
Java Bridge to do this, but this violates my desire to keep everything
>
Java. My timer approach works, but using 4% of the CPU to run a timer
>
4 times a second seems a bit extreme to me.
What about NSRunLoop?
public void performSelectorWithOrder( NSSelector aSelector, Object
target, Object anArgument, int order, NSArray modes)
I've never done any Cocoa-Java, but that looks like something you
could use to do what you want.
To offer a counterpoint, I am _so_ glad that Apple doesn't consider
threads the solution to everything. The runloop stuff handles about
90% of what you'd use threads for, and in a very elegant fashion for
typical event-driven apps IMO. Multithreading, especially in
languages with no memory protection, can be the cause of very
hard-to-debug problems.
--
=Nicholas Riley <email@hidden> | <
http://www.uiuc.edu/ph/www/njriley>
Pablo Research Group, Department of Computer Science and
Medical Scholars Program, University of Illinois at Urbana-Champaign
_______________________________________________
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.