[Haskell-cafe] How to ensure code executes in the context of a specific OS thread?
Jason Dagit
dagitj at gmail.com
Mon Jul 4 07:19:58 CEST 2011
On Sun, Jul 3, 2011 at 10:02 PM, Jason Dagit <dagitj at gmail.com> wrote:
> Hello,
>
> I'm trying to get some GUI code working on OSX and numerous forums
> around the internet keep reiterating that on OSX to correctly handle
> GUI events you need to use the original thread allocated to your
> process to check for events and to call the Cocoa framework
> functionality. Specifically, using a secondary thread (even a bound
> thread) is not sufficient with the Cocoa framework.
Context for others:
People explaining that you can't use the secondary thread for GUI operations:
http://www.cocoabuilder.com/archive/cocoa/298918-multithread-window-event-runloop-headache.html
http://old.nabble.com/Weird-Carbon%3A-gestalt%3A-wxPython-issue-bug-td27456897.html
http://www.cocoabuilder.com/archive/cocoa/205803-event-loop-in-secondary-thread-nibless-cocoa.html
http://forums.libsdl.org/viewtopic.php?t=6281&sid=ec818336d68f9797090719b3c5916c21
http://www.cocoabuilder.com/archive/cocoa/292830-nstimer-not-working-in-multithreaded-application.html
http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/Multithreading/CreatingThreads/CreatingThreads.html
http://www.cocoabuilder.com/archive/cocoa/152947-cocoa-multithreading-in-terrible-idea-isn-it.html
Cocoa provides several ways to run things on the "main thread" (same
as I meant when I said original thread):
http://blog.jayway.com/2010/03/30/performing-any-selector-on-the-main-thread/
http://www.noodlesoft.com/blog/2007/05/01/productive-waste-of-time-figuring-out-the-main-thread/
Jason
More information about the Haskell-Cafe
mailing list