Waiting on Sockets or File Descriptors

Peter Simons simons at cryp.to
Wed Feb 2 11:16:23 EST 2005

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 want to wait for something to happen -- I'd
like to be notified when something happens.

By the way, the source code for the module says:

  -- Note: threadDelay, threadWaitRead and threadWaitWrite
  -- aren't really functional on Win32, but left in there
  -- because lib code (still) uses them (the manner in which
  -- they're used doesn't cause problems on a Win32 platform
  -- though.)

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?


More information about the Glasgow-haskell-users mailing list