classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] [Fwd: Your Report (Review ID: 363752) - Thread.sleep(0) fai


From: Archie Cobbs
Subject: [cp-patches] [Fwd: Your Report (Review ID: 363752) - Thread.sleep(0) fails to detect interrrupted status]
Date: Thu, 30 Dec 2004 11:48:39 -0600
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129

FYI,
-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com


*
Confidentiality Notice: This e-mail message, including any attachments, is for 
the sole use of the intended recipient(s) and may contain confidential and 
privileged information. Any unauthorized review, use, disclosure or 
distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply e-mail and destroy all copies of 
the original message.
*
--- Begin Message --- Subject: Your Report (Review ID: 363752) - Thread.sleep(0) fails to detect interrrupted status Date: Thu, 30 Dec 2004 10:36:27 -0700 (MST)
************************************************
Your report has been assigned an internal review ID of: 363752

This review ID is NOT visible on the "Java Developer Connection" (JDC).

We greatly appreciate your interest in improving the quality
of Java(tm) Technology from Sun Microsystems.

Please be aware that the large volume of reports we receive
sometimes prevents us from responding individually to each
message.

We currently have a three week response time for responding to
Bug Reports.  If the information is determined to be a new bug,
or a duplicate of a known bug, you will receive a followup email
containing a seven digit bug number.  You may search for this bug
number on the "Java Developer Connection" (JDC) at this URL:
http://developer.java.sun.com/developer/bugParade/index.html.

If you just reported an issue that could have a major
impact on your project and you require a response,
please consider purchasing one of the support offerings
at this URL:
    http://java.sun.com/support/index.html


---------------------------------------------------------------


dateCreated: Thu Dec 30 10:36:23 MST 2004
type:        bug
cust_name:   Archie Cobbs
cust_email:  address@hidden
jdcid:       archie172
status:      Waiting
category:    java
subcategory: classes_lang
company:     Awarix
release:     1.4.2
hardware:    x86
OSversion:   linux
priority:    4
synopsis:    Thread.sleep(0) fails to detect interrrupted status
description: FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Linux foo.bar.com 2.4.22 #10 Fri Oct 31 14:12:30 CST 2003 i686 i686 i386 
GNU/Linux

Also occurs on FreeBSD and Windows.



A DESCRIPTION OF THE PROBLEM :
The API spec for Thread.sleep(long) and Thread.sleep(long, int) claims
that it throws InterruptedException "if another thread has interrupted the 
current thread".

First, this sentence is misleading, as a thread can interrupt itself. So it
should read "if any thread has interrupted the current thread."

Secondly, the implemetation fails according to this specification.
If Thread.sleep(0) or Thread.sleep(0,0) is invoked, InterruptedException
is *never* thrown, even if the thread has been interrupted.

Please either fix this bug or "fix" the spec (as Sun often prefers to do).



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run this program:

public class zz {
        public static void main(String[] args) throws Exception {
                Thread.currentThread().interrupt();
                Thread.sleep(0, 0);
        }
}



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
InterruptedException thrown
ACTUAL -
No exception thrown.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------

public class zz {
        public static void main(String[] args) throws Exception {
                Thread.currentThread().interrupt();
                Thread.sleep(0, 0);
        }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Invoke Thread.sleep(1) instead.
workaround:  
comments:    (company - Awarix , email - address@hidden)


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]