[Haskell] Network accept loop with graceful shutdown
haskell at catdancer.ws
Thu Dec 7 09:19:20 EST 2006
On 12/7/06, Chris Kuklewicz <haskell at list.mightyreason.com> wrote:
> Could you add info about where to get your code (or the code) itself to the wiki
> at http://haskell.org/haskellwiki/Concurrency_demos/Graceful_exit ?
OK, I did.
> "unblock yield" is the right code for a safepoint
Be careful. You are relying on the runtime to wake up the throwing
thread, to let it run long enough to raise the asynchronous exception,
and to have that complete before the thread doing the "unblock yield"
While a particular Haskell implementation might do all that on a
single processor system, it's hard to see how such a guarantee could
ever be offered on a multiprocessor system. These days it's common to
buy a computer with a dual core cpu, before long we'll be getting
cpu's with ten cores... and in a few years we'll be seeing hundred
core cpu's. "yield" is meaningless on a multiprocessor system.
I'd suggest that if you're using a concurrent language and you find
that the only way you can implement an algorithm is by using "yield",
either A) you're wrong and there is a way to implement it without
"yield", or B) your concurrent language is deficient and should be
More information about the Haskell