re PR libgcj/8997 (spin() calls Thread.sleep)

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.

Co-Authored-By: Ranjit Mathew <rmathew@hotmail.com>

From-SVN: r60700
This commit is contained in:
Tom Tromey 2002-12-31 17:43:47 +00:00 committed by Tom Tromey
parent 731e8b3886
commit 35a94bdca8
4 changed files with 32 additions and 2 deletions

View file

@ -1,6 +1,6 @@
// natObject.cc - Implementation of the Object class.
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
This file is part of libgcj.
@ -28,6 +28,8 @@ details. */
#include <java/lang/Cloneable.h>
#include <java/lang/Thread.h>
#include "platform.h"
#ifdef LOCK_DEBUG
# include <stdio.h>
#endif
@ -532,7 +534,7 @@ spin(unsigned n)
unsigned duration = MIN_SLEEP_USECS << (n - yield_limit);
if (n >= 15 + yield_limit || duration > MAX_SLEEP_USECS)
duration = MAX_SLEEP_USECS;
java::lang::Thread::sleep(0, duration);
_Jv_platform_usleep(duration);
}
}