Thread.list has a race condition
--------------------------------

                 Key: JRUBY-2380
                 URL: http://jira.codehaus.org/browse/JRUBY-2380
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1
         Environment: Latest JRuby 1.1
            Reporter: Vladimir Sizikov


Basically, Thread.list doesn't show the just started thread:

{noformat}
t = Thread.new {sleep 5}
p t
p Thread.list
{noformat}

JRuby prints:
#<Thread:0x1e2befa run>
[#<Thread:0x1630ab9 run>]
Registering the thread...#<Thread:0x1e2befa>

(The registering in thread output is just added by me when the thread is being 
registered with the service).

As you see, the created thread has "run" status, but the thread list doesn't 
have it, since the thread is not yet registered with the ThreadService. After a 
small delay, the Thread.list returns the new thread correctly.

MRI, btw, returns the proper list right away.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to