JNF performOnMainThreadWaiting thread safety

Petr Pchelko petr.pchelko at oracle.com
Tue Feb 19 03:35:30 PST 2013


Hello, Leonid. 

The following is just my speculation, so it might be not true.

The JNFRunLoop reference does not state if this method is thread-safe or not, however it should probably be implemented by NSObject performOnMainThreadWaiting method. And NSObject is thread-safe according to the documentation.

So I think that it is much more likely to be thread-safe than not. 
However, only someone how've seen the implementation of the JNFRunLoop would be 100% sure. 

With best regards. Petr. 


On Feb 19, 2013, at 5:22 AM, Leonid Romanov wrote:

> Hi,
> I've got a question: is + (void)performOnMainThreadWaiting:(BOOL)waitUntilDone withBlock:(void (^)())block thread safe? Suppose two native threads are calling this method with waitUntilDone set to YES.  Should we be OK in this case or some external locking is necessary to ensure that both threads won't call performOnMainThreadWaiting at the "same" time?
> 
> Thanks,
> Leonid.



More information about the macosx-port-dev mailing list