RE: Concurrent Haskell (GHC) and Win32 Applications ?

| 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. Yes, that's true at the moment, but it's something that we expect to fix shortly. More precisely, Sigbjorn has been working on a fix. It relies on using an OS thread to make a potentially-blocking call, so it's a robust fix. I don't quite know when he'll be done with this -- Sigbjorn do you know? Meanwhile, all you can do is to avoid making blocking I/O calls. Simon

"Simon Peyton-Jones"
| 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.
Yes, that's true at the moment, but it's something that we expect to fix shortly. More precisely, Sigbjorn has been working on a fix. It relies on using an OS thread to make a potentially-blocking call, so it's a robust fix.
I don't quite know when he'll be done with this -- Sigbjorn do you know?
Modulo settling a couple of minor implementation details, I'd say it's done. To try it out, check out the fptools/ CVS sources, and configure & build it with the option --enable-threaded-rts Non-blocking callouts are enabled by attributing a 'foreign import' with 'threadsafe' (instead of 'unsafe' or 'safe') -- e.g., foreign import "wait" threadsafe snail :: IO () --sigbjorn

"Sigbjorn Finne"
Yes, that's true at the moment, but it's something that we expect to fix shortly. More precisely, Sigbjorn has been working on a fix. It relies on using an OS thread to make a potentially-blocking call, so it's a robust fix.
Modulo settling a couple of minor implementation details, I'd say it's done. To try it out, check out the fptools/ CVS sources, and configure & build it with the option --enable-threaded-rts
Ahem - how far would this be from a "real" multithreaded implementation, i.e. one that could use a few OS threads to take advantage of multiple CPUs in an SMP system? -kzm -- If I haven't seen further, it is by standing in the footprints of giants

I would like to print an unboxed value to the screen. But to use "show" on a type it has to be boxed. How do I rebox an unboxed type? Sorry if the answer to this is obvious - I have spent quite some time looking for the solution. Sean

I would like to print an unboxed value to the screen. But to use "show" on a type it has to be boxed. How do I rebox an unboxed type? Sorry if the answer to this is obvious - I have spent quite some time looking for the solution.
You need to know what kind of box - the unboxed value no longer has the `tag' saying what type it is.
Boxed Ints, for example, are declared like this in the prelude:
data Int = I# Int#
So to build an Int from an Int#, simply say (I# x), like this:
case (+# 1# 42#) of {
x -> show (I# x)
}
(you'll probably need to import whichever module has the definition of Int in it).
Hope this helps..
--KW 8-)
--
Keith Wansbrough
participants (5)
-
Keith Wansbrough
-
ketil@ii.uib.no
-
Sean Seefried
-
Sigbjorn Finne
-
Simon Peyton-Jones