Concurrent Haskell (GHC) and Win32 Applications ?

Jonas Svensson d99josve@dtek.chalmers.se
Sat, 9 Mar 2002 15:50:38 +0100


Sat, Mar 09, 2002 at 11:44:22PM +1030, Antony Blakey ->
> Hi,
>    I'm experimenting with GHC as a platform for writing a Win32 GUI 
> application, and I've hit what I think is a brick wall.
> 
> The problem I think is with the lightweight thread implementation - 
> Win32 calls can (and will) block the OS thread that makes the call, 
> which blocks the entire system. Given that I'm wanting to write a 
> network server with a Win32 GUI, this is obviously a Bad Thing.

While I haven't used GHC with the Win32 GUI I've had a similar problem
with the gtk+hs bindings.

See the ``concurrent haskell'' thread in:
http://haskell.org/pipermail/gtkhs/2002-February/thread.html

Basically, make sure that a Haskell function is called once in a while
(for example add it as a timer callback) and make this function call
yeild. I'm not sure the Win32 API works the same way but it might be worth
a try.

/jonas
-- 
%http://www.dtek.chalmers.se/~d99josve/ - d99josve@dtek.chalmers.se