Comment 20 for bug 520715

Revision history for this message
Lucas Nussbaum (lucas) wrote : Re: [Bug 520715] Re: building ruby1.8 with pthread support causes puppet hangs

On 18/02/10 at 06:51 -0000, Nigel Kersten wrote:
> I had a quick look at Timeout. The problem is there in:
>
> x = Thread.current
> y = Thread.start {
> sleep sec
> x.raise exception, "execution expired" if x.alive?
> }
>
> and Thread x.status returns a sleep state even after the test execs
> complete, which seems pretty fundamentally broken... I'll have a look
> and see if I can find a dupe
>
> confirmed on stock Lucid and Debian testing.

No, that's not a bug. How it works is that the code is executed (yield
sec), and if it finishes before the timeout, the thread is killed
(y.kill if y and y.alive?), so the exception is never raised.

So, on the paper, it looks correct. However, I'm not sure of the
atomicity guarantees provided by the interpreter here. Might be a
problem.
--
| Lucas Nussbaum
| <email address hidden> http://www.lucas-nussbaum.net/ |
| jabber: <email address hidden> GPG: 1024D/023B3F4F |