Follow-up: Cocoa thread-safety
Follow-up: Cocoa thread-safety
- Subject: Follow-up: Cocoa thread-safety
- From: Steve Klingsporn <email@hidden>
- Date: Fri, 25 Oct 2002 23:07:03 -0500
The following is written in the 10.2 Cocoa release notes:
New methods for performing selectors on the main thread
Sometimes a background thread must have the main thread perform some
work on its behalf. These are often UI-related things, like updating a
window's displayed state. Two new methods on NSObject, declared in
<Foundation/NSThread.h>, have been added in 10.2.
- (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg
waitUntilDone:(BOOL)wait modes:(NSArray *)array;
- (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg
waitUntilDone:(BOOL)wait;
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.
Any help would be appreciated. Thank you.
Steve
_______________________________________________
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.