On Feb 19, 2011, at 3:10, Ken Thomases wrote:

> On Feb 17, 2011, at 8:48 AM, Marco Antognini wrote:
> 
>> But now I'm stuck with a problem : is there any way to create/destroy 
>> window/view, make them live (e.g. rendering process) and get event 
>> notification; all that only in a worker thread (like we can do on Linux or 
>> Windows) ?
> 
> Short answer: no.
> 
> To the Mac frameworks, the main thread is special.  The main thread is always 
> the original thread of the process.  You can't designate which thread is the 
> main thread.
> 
> One can poke around in the Darwin sources to see that the non-portable 
> pthread_main_np() function is determined as the C library initializes itself, 
> and further that CFRunLoopGetMain() and similar functions rely on it.
> 
> Also, some of the frameworks install run loop sources on the current thread's 
> run loop when they are loaded.  For a typical program, they are loaded when 
> the executable is loaded when there is only the main thread. So, their run 
> loop sources are only processed on the main thread.
> 
> I think your best bet is to reserve the main thread for running the standard 
> main application event loop and spawn a secondary thread to run the work of 
> the client of your library.  I realize this is a cumbersome requirement on 
> both you and the clients of the library.  Sorry I don't have better news.
> 
> Regards,
> Ken
> 

That's what I was afraid of...

Anyway, thank you for your answer even if it's bad news for me.

Best,
Marco_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to