[Openmcl-devel] thread overview

Gary Byers gb at clozure.com
Sun Aug 22 18:22:11 PDT 2004



On Sun, 22 Aug 2004, alex crain wrote:


> Ok, tell me if I've got this right:
>
> openmcl starts with a main thread and a listener thread. When cocoa
> starts, it co-opts the
> main thread to handle cocoa events. This thread is then used to spawn
> other cocoa related
> threads, like the ones associated with hemlock windows.
>

Correct.

> Since the main thread is busy responding to cocoa events, it's not
> doing the periodic tasks
> anymore, so the main thread (now the cocoa event thread) spawns a new
> thread to do
> housekeeping.

Correct.

>
> So, when I send a keystroke to a hemlock window, which thread does the
> actual processing?

The Cocoa event thread receives events from the window server.  It is
the only thread which can do so.


> Is it the hemlock window thread, or does the main thread receive the
> event and pass it to the
> appropriate place?
>

Key-down events that're directed to hemlock windows get passed to
that window's dedicated thread (the incoming NSEvent is mapped to
a hemlock KEY-EVENT structure.)  Hemlock commands that affect the
contents of the buffer and/or the selection currently do so by
invoking methods on the main thread; I think that this is probably
overkill.

Other events (mouse-down/drag, etc.) related to hemlock windows get
handled in the Cocoa event thread.

> :alex



More information about the Openmcl-devel mailing list