Re: Waiting on Sockets or File Descriptors

2005-02-03 Thread Wolfgang Thaller
If I understood this right, then I can use forkIO to run a "safe" FFI function which blocks, but in the threaded RTS this will not block all other FFI calls. Right. So what happens in the non-threaded RTS? Now the blocking yet "safe" FFI invocation _would_ block other FFI calls but not evaluation o

Re: Waiting on Sockets or File Descriptors

2005-02-03 Thread Peter Simons
Simon Marlow writes: > When you compile your program with -threaded, "safe" FFI > calls don't block other threads, but "unsafe" calls still > do. Basically a "safe" FFI call releases the lock on the > RTS so other Haskell threads can continue to run [...]. Thanks for the clarification. If I

Re: Waiting on Sockets or File Descriptors

2005-02-03 Thread Malcolm Wallace
> On 02 February 2005 19:48, Peter Simons wrote: > > > Wolfgang Thaller writes: > > > > > a) poll() is not supported on Mac OS X and (at least some > > > popular versions of) BSD. > > > > Are you certain? Just tried "man poll" on one of the MacOS X > > machines the SourceForge compile farm off

RE: Waiting on Sockets or File Descriptors

2005-02-03 Thread Simon Marlow
On 02 February 2005 19:48, Peter Simons wrote: > Wolfgang Thaller writes: > > > a) poll() is not supported on Mac OS X and (at least some > > popular versions of) BSD. > > Are you certain? Just tried "man poll" on one of the MacOS X > machines the SourceForge compile farm offers, and that one

Re: Waiting on Sockets or File Descriptors

2005-02-02 Thread Peter Simons
Wolfgang Thaller writes: > a) poll() is not supported on Mac OS X and (at least some > popular versions of) BSD. Are you certain? Just tried "man poll" on one of the MacOS X machines the SourceForge compile farm offers, and that one had it: "Darwin ppc-osx1 5.5 Darwin Kernel Version 5.5". >

Re: Waiting on Sockets or File Descriptors

2005-02-02 Thread Wolfgang Thaller
So I guess I can't really use them in code that's supposed to be portable among different platforms? Maybe 'forkOS' combined with calling poll() through FFI really is the best solution? I seem to recall reading somewhere that the threaded RTS was more efficient for these applications anyway? Two mi

Re: Waiting on Sockets or File Descriptors

2005-02-02 Thread Peter Simons
Tomasz Zielonka writes: >> Like select(2) or poll(2) would do? > You seem to what something low-level. Well, my point is that I don't really want to deal with the file descriptors. What I'd really like to do is to register a call-back function; similar to the way signal handlers work. I don't

Re: Waiting on Sockets or File Descriptors

2005-02-02 Thread Tomasz Zielonka
On Wed, Feb 02, 2005 at 05:58:58AM -0800, Peter Simons wrote: > Tomasz Zielonka writes: > > > threadWaitRead :: Int -> IO () > > threadWaitWrite :: Int -> IO () > > Thanks for the pointer! > > Am I correct in assuming that there is no "more high-level" > mechanism for scheduling more t

Re: Waiting on Sockets or File Descriptors

2005-02-02 Thread Carsten Schultz
Hi! On Wed, Feb 02, 2005 at 02:57:24PM +0100, Peter Simons wrote: > Tomasz Zielonka writes: > > > threadWaitRead :: Int -> IO () > > threadWaitWrite :: Int -> IO () > > Thanks for the pointer! > > Am I correct in assuming that there is no "more high-level" > mechanism for scheduling

Re: Waiting on Sockets or File Descriptors

2005-02-02 Thread Peter Simons
Tomasz Zielonka writes: > threadWaitRead :: Int -> IO () > threadWaitWrite :: Int -> IO () Thanks for the pointer! Am I correct in assuming that there is no "more high-level" mechanism for scheduling more than one file descriptor? Like select(2) or poll(2) would do? I guess, I could i

Re: Waiting on Sockets or File Descriptors

2005-02-01 Thread Tomasz Zielonka
On Tue, Feb 01, 2005 at 03:16:44PM -0800, Peter Simons wrote: > Hi, > > I have the following problem: I use an external library > through the foreign function interface which gives me > _several_ sockets and expects me to call it again when any > of those sockets becomes readable or writable. > >

Waiting on Sockets or File Descriptors

2005-02-01 Thread Peter Simons
Hi, I have the following problem: I use an external library through the foreign function interface which gives me _several_ sockets and expects me to call it again when any of those sockets becomes readable or writable. Since I know that the Haskell run-time system has all the required functional