Hi,
As you know, ruby thread start to execute when created, like
Thread.new do ......end
Here my question is how can I defer the thread execution until something happened, like an event?
Thanks,Brian
Huh? Is this a serious question? The solution seems pretty obvious.
Cheers
robert
···
On Fri, Dec 7, 2012 at 10:05 AM, XueBrian <brian.xue@hotmail.com> wrote:
As you know, ruby thread start to execute when created, like
Thread.new do
......
endHere my question is how can I defer the thread execution until something
happened, like an event?
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
Quoting XueBrian (brian.xue@hotmail.com):
Here my question is how can I defer the thread execution until
something happened, like an event?
I am not sure I understand what you want to do. Threads can be stopped
and restarted. If, from within the code of your thread, you call first
thing
Thread::stop
then, whenever you need the execution to restart, you can call t.run
from your main process. Look at the example that is returned to you by
running.
ri Thread::stop
HTH
Carlo
···
Subject: how to trigger a thread by event
Date: Fri 07 Dec 12 06:05:43PM +0900
--
* Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
* di parlare tanto di amore e di rettitudine? (Chuang-Tzu)
I do not recommend doing that. Generally one should rather use thread
synchronization primitives to control execution of threads.
Cheers
robert
···
On Fri, Dec 7, 2012 at 10:18 AM, Carlo E. Prelz <fluido@fluido.as> wrote:
Subject: how to trigger a thread by event
Date: Fri 07 Dec 12 06:05:43PM +0900Quoting XueBrian (brian.xue@hotmail.com):
Here my question is how can I defer the thread execution until
something happened, like an event?I am not sure I understand what you want to do. Threads can be stopped
and restarted. If, from within the code of your thread, you call first
thingThread::stop
then, whenever you need the execution to restart, you can call t.run
from your main process. Look at the example that is returned to you by
running.
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/