[Backgroundrb-devel] Job Queue
Norman Elton
normelton at gmail.com
Fri Feb 1 13:58:31 EST 2008
After some initial stumblings, I think I've got the hang of
backgroundrb. It's great! I'd been thinking for many many months how
cool something like this would be!
I'm trying to make a "job queue". That is, a pool of worker threads
monitor a queue. When a job appears, one of the workers grabs it and
executes the task. When complete, the worker returns to watching the
queue. If all workers are busy, jobs simply sit in the queue until the
resources are available.
I can see how to build an array containing jobs. And a mutex could be
used to ensure thread-safe access to the array. But how can the
workers "go to sleep" until a job arrives?
Any thoughts?
Thanks again!
Norman
More information about the Backgroundrb-devel
mailing list