Bug 8997 - spin() calls Thread.sleep
Summary: spin() calls Thread.sleep
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libgcj (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-18 14:26 UTC by Tom Tromey
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2002-12-18 14:26:01 UTC
I let in a small change to natObject.cc that changed spin() to call
Thread::sleep instead of usleep().

I think this was a mistake (to be honest I don't recall seeing that
code in a patch, double oops on me).  spin() is used in the
implementation of _Jv_MonitorEnter; the point as I understand it is to
sleep a bit to avoid creating a heavyweight mutex.  However,
Thread::sleep() acquires just such a mutex -- defeating the purpose of
spin().

(See java list for more info.)

Release:
unknown
Comment 1 Tom Tromey 2002-12-19 11:13:28 UTC
Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-Why: I'm handling this.
Comment 2 Tom Tromey 2002-12-19 11:13:28 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: I've submitted a partial patch.
    It is waiting for a follow-up patch from Ranjit or Adam.
Comment 3 Tom Tromey 2002-12-31 09:44:56 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: I've checked in the fix.
Comment 4 Tom Tromey 2002-12-31 17:43:47 UTC
From: tromey@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: libgcj/8997
Date: 31 Dec 2002 17:43:47 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	tromey@gcc.gnu.org	2002-12-31 09:43:47
 
 Modified files:
 	libjava        : ChangeLog 
 	libjava/include: posix.h win32.h 
 	libjava/java/lang: natObject.cc 
 
 Log message:
 	2002-12-31  Tom Tromey  <tromey@redhat.com>
 	Ranjit Mathew  <rmathew@hotmail.com>
 	
 	Fix for PR libgcj/8997:
 	* java/lang/natObject.cc (spin): Use _Jv_platform_usleep.
 	Include platform.h.
 	* include/posix.h (_Jv_platform_usleep): New function.
 	* include/win32.h (_Jv_platform_usleep): New function.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.1607&r2=1.1608
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/include/posix.h.diff?cvsroot=gcc&r1=1.13&r2=1.14
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/include/win32.h.diff?cvsroot=gcc&r1=1.16&r2=1.17
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/lang/natObject.cc.diff?cvsroot=gcc&r1=1.23&r2=1.24
 

Comment 5 Tom Tromey 2002-12-31 17:44:43 UTC
From: tromey@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: libgcj/8997
Date: 31 Dec 2002 17:44:43 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	tromey@gcc.gnu.org	2002-12-31 09:44:43
 
 Modified files:
 	libjava        : ChangeLog 
 	libjava/include: posix.h win32.h 
 	libjava/java/lang: natObject.cc 
 
 Log message:
 	2002-12-31  Tom Tromey  <tromey@redhat.com>
 	Ranjit Mathew  <rmathew@hotmail.com>
 	
 	Fix for PR libgcj/8997:
 	* java/lang/natObject.cc (spin): Use _Jv_platform_usleep.
 	Include platform.h.
 	* include/posix.h (_Jv_platform_usleep): New function.
 	* include/win32.h (_Jv_platform_usleep): New function.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.1594.2.10&r2=1.1594.2.11
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/include/posix.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.13&r2=1.13.2.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/include/win32.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16&r2=1.16.2.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/lang/natObject.cc.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.23&r2=1.23.4.1