[Haskell-cafe] Wait forever in main thread

John Millikin jmillikin at gmail.com
Tue May 18 15:38:58 EDT 2010


On Tue, May 18, 2010 at 08:06, David Leimbach <leimy2k at gmail.com> wrote:
> I think you just said the same thing I just said.  So are we arguing?  I'm
> kind of confused.  "If some computation needs to be performed, a thread is
> spawned" is very similar to what I just said about multiplexing the signal
> handling into one thread and spawning worker threads.
> I never mentioned a thread pool, and agree with you that it probably doesn't
> make any sense in this discussion.
> It might just be that I don't know anything about your DBus library that's
> causing this discussion to go this way.  Let me look at it and get back to
> you.

This might be a terminology problem. A "signal handler" is a
computation (an IO value) which is performed when a signal message is
received. It doesn't make any sense to run signal handlers in one
thread, because each handler might take an arbitrary amount of time to
execute.

I read your email as suggesting that handlers should be run in a
single thread, with additional threads being pooled/spawned when the
developer suspects some handler might take a significant amount of
time. In theory this would be identical to giving each handler its own
thread, but I suspect that it would simply make it more likely for
inexperienced developers to accidentally block their socket.


More information about the Haskell-Cafe mailing list