[Backgroundrb-devel] delete_worker doesn't kill the thread?
Charles Brian Quinn
me at seebq.com
Mon Jul 31 19:07:38 EDT 2006
Couldn't you do something like this:
# in your initalize worker put:
@running = true
in your main work method:
while @running
@logger << "logging #{Time.now}"
sleep 2
end
add a method:
def stop
@running = false
end
Now before deleting the worker, just call stop. I am curious about
the behavior you're seeing, though.
On 7/31/06, Ben Johnson <bjohnson at contuitive.com> wrote:
>
> I made a worker that run an infinite loop and does the following:
>
> while true
> @logger << "logging #{Time.now}"
> sleep 2
> end
>
> In my secong console I did:
>
> tail log/backgroundrb.log -f
>
> This is so I could see the line getting added to the log every 2 seconds.
>
> Then in my other console I started script/console and created a new worker.
> Then killed it with MiddleMan.delete_worker(job_key), where job_key was the
> job key for the worker.
>
> After I did that the other console that was monitoring my log continued to
> add a line every 2 seconds, it didn't stop.
>
> Am I missing something here or shouldn't deleting a worker stop the loop and
> kill the thread?
>
> Thanks for your help.
>
> Thank You,
> Ben Johnson
> E: bjohnson at contuitive.com
>
>
>
>
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>
>
--
Charles Brian Quinn
www.seebq.com
More information about the Backgroundrb-devel
mailing list