On Tue, May 18, 2010 at 8:06 AM, David Leimbach
<leimy2k@gmail.com> wrote:
On Tue, May 18, 2010 at 7:08 AM, John Millikin
<jmillikin@gmail.com> wrote:
On Mon, May 17, 2010 at 19:41, David Leimbach <leimy2k@gmail.com> 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, method calls, method returns, etc are read from the
socket in a single thread. If some computation needs to be performed,
a thread is spawned. There's no "thread pool", and I doubt such a
construct would provide any benefit.
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.
I've taken a few minutes to look through the documentation and dbus-core stuff on Hackage (quite nice by the way!!!), and I get where this is all going finally.
The original poster of this thread asked a generic question about making a thread wait and synchronize with another, but the thread in question didn't do anything so I could not figure out why on earth anyone would want to do that.
I think I see now that your library takes registered handlers to run and that there is nothing to be done in the main thread if you're just gathering events and dealing with them in each handler thread.
For the application at hand, you're correct on all points. I was trying to have a more general discussion of what might be possible in other frameworks assuming nothing about their design. Sorry if I derailed the thread.
At least it's given me a couple of ideas for things to try out, and I learned a little something about DBus.
Dave