Re: [Haskell-cafe] Wait forever in main thread

2010-05-18 Thread John Millikin
On Tue, May 18, 2010 at 08:06, David Leimbach 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 int

Re: [Haskell-cafe] Wait forever in main thread

2010-05-18 Thread David Leimbach
On Tue, May 18, 2010 at 8:06 AM, David Leimbach wrote: > > > On Tue, May 18, 2010 at 7:08 AM, John Millikin wrote: > >> On Mon, May 17, 2010 at 19:41, David Leimbach wrote: >> > Is there not a way to multiplex the signal handlers into one thread, and >> > then dispatch new threads to do the work

Re: [Haskell-cafe] Wait forever in main thread

2010-05-18 Thread David Leimbach
On Tue, May 18, 2010 at 7:08 AM, John Millikin wrote: > On Mon, May 17, 2010 at 19:41, David Leimbach wrote: > > Is there not a way to multiplex the signal handlers into one thread, and > > then dispatch new threads to do the work when events that require such > > concurrency occur? > > That wou

Re: [Haskell-cafe] Wait forever in main thread

2010-05-18 Thread John Millikin
On Mon, May 17, 2010 at 19:41, David Leimbach wrote: > Is there not a way to multiplex the signal handlers into one thread, and > then dispatch new threads to do the work when events that require such > concurrency occur? > That would be the initial way I'd structure such a program. All signals,

Re: [Haskell-cafe] Wait forever in main thread

2010-05-17 Thread David Leimbach
On Mon, May 17, 2010 at 2:37 PM, John Millikin wrote: > Author of dbus-client here. Don Stewart's solution (blocking on an > mvar) is the best way to handle it. Presumably, you've got some way to > make your program shut down (method call? signal handler?) -- just set > the mvar in that. > > On M

Re: [Haskell-cafe] Wait forever in main thread

2010-05-17 Thread Bas van Dijk
On Mon, May 17, 2010 at 7:12 PM, Don Stewart wrote: > dpx.infinity: >> Hi, >> I'm writing a program which listens to some D-Bus signals using >> DBus.Client.onSignal function from dbus-client package. This function >> runs IO action in separate haskell thread when signal is received. My >> program

Re: [Haskell-cafe] Wait forever in main thread

2010-05-17 Thread John Millikin
Author of dbus-client here. Don Stewart's solution (blocking on an mvar) is the best way to handle it. Presumably, you've got some way to make your program shut down (method call? signal handler?) -- just set the mvar in that. On Mon, May 17, 2010 at 11:07, David Leimbach wrote: > You could ask y

Re: [Haskell-cafe] Wait forever in main thread

2010-05-17 Thread Roel van Dijk
Use our threads package [1]. import Control.Concurrent.Thread ( forkIO, wait_ ) myDBusThingie :: IO () myDBusThingie = error "TODO" main :: IO () main = do tid <- forkIO myDBusThingie wait_ tid But like David said, this is only usefull if you plan on multiple concurrent waits or doin

Re: [Haskell-cafe] Wait forever in main thread

2010-05-17 Thread David Leimbach
On Mon, May 17, 2010 at 10:04 AM, DPX-Infinity wrote: > Hi, > I'm writing a program which listens to some D-Bus signals using > DBus.Client.onSignal function from dbus-client package. This function > runs IO action in separate haskell thread when signal is received. My > program does nothing excep

Re: [Haskell-cafe] Wait forever in main thread

2010-05-17 Thread Don Stewart
dpx.infinity: > Hi, > I'm writing a program which listens to some D-Bus signals using > DBus.Client.onSignal function from dbus-client package. This function > runs IO action in separate haskell thread when signal is received. My > program does nothing except signal handling, so after setting up >

[Haskell-cafe] Wait forever in main thread

2010-05-17 Thread DPX-Infinity
Hi, I'm writing a program which listens to some D-Bus signals using DBus.Client.onSignal function from dbus-client package. This function runs IO action in separate haskell thread when signal is received. My program does nothing except signal handling, so after setting up signals it has to wait ind