Whilst everyone is discussing threads, does anybody know if hGetContents is well behaved with respect to threads - ie does it use threadWaitRead internally? I know it uses unsafePerfomIO, is a function that interleaves IO using unsafePerformIO automatically haskell-thread safe? - also do I need to use threadWaitWrite before any hPut - or do the hPut functions do this internally? Regards, Keean Schupke.
Hi, you should never have to use any of these primops directly when working with Handles, nor have to worry about handles being shared among different Concurrent Haskell threads. The IO implementation takes care of it for you. Well, that's assuming the platform you're working on supports non-blocking file descriptors and select()ing on them -- Win32 doesn't, but changes are coming along which adds non-blocking I/O support for that platform also. --sigbjorn ----- Original Message ----- From: "MR K P SCHUPKE" <k.schupke@ic.ac.uk> To: <glasgow-haskell-users@haskell.org> Sent: Monday, June 17, 2002 03:24 Subject: hGetContents and threadWaitRead?
Whilst everyone is discussing threads, does anybody know if hGetContentsis well behaved with respect to threads - ie does it use threadWaitRead internally? I know it uses unsafePerfomIO, is a function that interleaves IO using unsafePerformIO automatically haskell-thread safe? - also do I need to use threadWaitWrite before any hPut - or do the hPut functions do this internally?
Regards, Keean Schupke.
participants (2)
-
MR K P SCHUPKE -
Sigbjorn Finne