Skip navigation.
 
mlRe: Event loop in a secondary thread? Nibless Cocoa?
FROM : Jens Alfke
DATE : Sun May 04 05:04:35 2008

On 3 May '08, at 4:35 PM, Bruce Sherwood wrote:

> Visual, which is written in multithreaded C++, can be imported 
> dynamically at any time in a Python program. Visual then has to 
> start up an event loop to make a window and process events.


Oh boy, this is a flashback. You've got the exact same issues we had 
when we brought up Java on OS X back in 2000. The process starts out 
GUI-less (just an invocation of /usr/bin/python, in your case) and has 
to acquire a windowserver connection, event loop, menus, all that stuff.

This is pretty tricky stuff, or it was back then, and we had the 
advantage of being able to use or create private APIs. But more of 
that stuff might be public now. (Wasn't there some discussion on this 
list recently of upgrading a command-line process to a GUI?)

IIRC, you don't have to start the event loop on the process's main 
thread, but whatever thread you create the WindowServer connection on 
becomes the de facto GUI thread, on which the main event loop will run.

I don't see any problem with loading nibs. You just have to find them 
— presumably you'd put them next to wherever you put your code.

—Jens

Related mailsAuthorDate
mlEvent loop in a secondary thread? Nibless Cocoa? Bruce Sherwood May 4, 01:35
mlRe: Event loop in a secondary thread? Nibless Cocoa? John C. Randolph May 4, 03:55
mlRe: Event loop in a secondary thread? Nibless Cocoa? B.J. Buchalter May 4, 04:51
mlRe: Event loop in a secondary thread? Nibless Cocoa? Bruce Sherwood May 4, 04:52
mlRe: Event loop in a secondary thread? Nibless Cocoa? Jens Alfke May 4, 05:04
mlRe: Event loop in a secondary thread? Nibless Cocoa? Bruce Sherwood May 4, 05:13
mlRe: Event loop in a secondary thread? Nibless Cocoa? Jens Alfke May 4, 05:18
mlRe: Event loop in a secondary thread? Nibless Cocoa? Kyle Sluder May 4, 05:18
mlRe: Event loop in a secondary thread? Nibless Cocoa? Jean-Daniel Dupas May 4, 11:55
mlRe: Event loop in a secondary thread? Nibless Cocoa? Ken Thomases May 4, 21:47