[Mono-bugs] [Bug 347837] New: Value of ThreadState not consistent

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Dec 11 17:43:08 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=347837


           Summary: Value of ThreadState not consistent
           Product: Mono: Runtime
           Version: 1.2.5
          Platform: i686
        OS/Version: Ubuntu
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: aganguly at gmail.com
         QAContact: mono-bugs at ximian.com
          Found By: Other


Created an attachment (id=187044)
 --> (https://bugzilla.novell.com/attachment.cgi?id=187044)
cs file.

Hello, 
I have a thread T1 which is waiting to acquire a lock (as in lock(_sync)). This
lock is held by a thread T2 which has acquired the lock and gone to sleep. 

In my main thread (that created T1 and T2), I queried the state of T1 and it
said "Running". I assume T1 should be in "WaitSleepJoin" state, that is what
the .NET documentation states, Monitor.Enter() should cause a thread to move
into "WaitSleepJoin". 

Furthermore, while T1 is waiting for the lock, from the main thread I sent
T1.Interrupt(). No ThreadInterruptedException is thrown while the thread is
waiting. T1 eventually gets the lock, moves forward. 


In addition, when T1 has called Sleep(), T1.Interrupt() only wakes it  from the
Sleep (no exception thrown). 

To summarize:
I was expecting the following:
1. When T1 was waiting for lock, T1.ThreadState == WaitSleepJoin
2. When T1 was waiting for lock, T1.Interrupt() should have thrown
ThreadInterruptedException. 
3. When T1 is Sleeping (Sleep()), T1.Interrupt() ends the Sleep() without
throwning exception. 


For the attached program:
1. compile using gmcs test.cs
2. ./text.exe
3. As soon as you see:
started t1.
started t2.
t2 acquired lock.
> Press enter: this will print out
WaitSleepJoin
t1 trying to acquire lock: 12/11/2007 5:37:00 PM

> At this point, t1 is waiting for a lock t2 will hold for about 20 seconds. 
> Again press enter (within the above 20 seconds), and you will see the current > state of T1, further more pressing enter also Interrupts() the thread. No exception is raised, even in the next attempt when T1 has to wait for the lock (if T2 took it away).
Running


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list