gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Glib runloop


From: Adrian Robert
Subject: Re: Glib runloop
Date: Sun, 17 Apr 2005 11:36:53 -0400

On 2005-04-17 10:54:13 -0400 Helge Hess <address@hidden> wrote:

On 16. Apr 2005, at 14:31 Uhr, Banlu Kemiyatorn wrote:
Has anyone tried to unify Glib runloop and NSRunLoop?

Well, yes, I did for GTKKit:

http://mail.gnome.org/archives/gtk-devel-list/1999-March/msg00158.html

but 1999 is quite a while ago ;-)

Does this mean to reimplement NSRunLoop entirely?

I think not necessarily, but it might be the easiest approach. I suppose a lot of things have changed in glib since 1999, so it might be rather easy to wrap the glib runloop as an NSRunLoop object.

Personally I would be quite interested in such a work.


As an additional source of ideas, Emacs.app runs the NSRunLoop inferior to the main event loop run by the lisp engine. When the lisp engine calls a select() (with nonzero timeout), [NSApp run] is called to process pending NS events. A timer is set up to periodically call select() (with zero timeout). When an NS event is received, it is converted to be handed over to the lisp engine, then an NSApplicationDefined event is appended to the queue. NSApplication -sendEvent is overridden to intercept these and call [NSApp stop]. (I tried using NSFileHandle instead of timer-based polling to handle the select(), but this caused a problem with NSAutoreleasePool management on OS X.)

You could probably do something similar in a plain NSRunloop (no NSApp) environment, but I haven't tried, and I'm not sure whether it would generalize well to multithreading. (And note the NSApp approach on GNUstep requires a patch to NSApplication which hasn't been checked in yet.. I'm hoping to do it soon.)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]