[Haskell-cafe] How to ensure code executes in the context of a specific OS thread?

David Barbour dmbarbour at gmail.com
Wed Jul 6 18:14:02 CEST 2011


On Wed, Jul 6, 2011 at 8:09 AM, Simon Marlow <marlowsd at gmail.com> wrote:

> On 06/07/2011 15:42, Jason Dagit wrote:
>
>> How can I make sure my library works from GHC (with arbitrary
>
> user threads) and from GHCI?
>>
>

Right, but usually the way this is implemented is with some cooperation from
> the main thread. [...] So you can't just do this from a library - the main
> thread has to be in on the game. I suppose you might wonder whether the GHC
> RTS could implement runInMainThread by preempting the main thread and
> running some different code on it.  [...]
>

I think the real issue is that GHC has a different behavior than GHCi, and I
think this causes a lot of difficulties for people working on GUI and other
FFI integration.

Perhaps it would be possible to reverse the default roles of threads in
GHCi: the main thread run user commands, and a second bound thread will
process user interrupts and such.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110706/470160d0/attachment.htm>


More information about the Haskell-Cafe mailing list