This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: platform usleep function
- From: Tom Tromey <tromey at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Cc: Ranjit Mathew <rmathew at vsnl dot net>
- Date: 19 Dec 2002 12:12:48 -0700
- Subject: Patch: platform usleep function
- Reply-to: tromey at redhat dot com
Here is the platform usleep patch. Ranjit, could you implement
_Jv_platform_usleep for Win32? Patch form would be great. Once I
have that I'll check it all in.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* java/lang/natObject.cc (spin): Use _Jv_platform_usleep.
Include platform.h.
* include/posix.h (_Jv_platform_usleep): New function.
Index: include/posix.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/posix.h,v
retrieving revision 1.13
diff -u -r1.13 posix.h
--- include/posix.h 10 Dec 2002 01:39:32 -0000 1.13
+++ include/posix.h 19 Dec 2002 19:10:54 -0000
@@ -60,6 +60,12 @@
::fcntl (fd, F_SETFD, FD_CLOEXEC);
}
+inline void
+_Jv_platform_usleep (unsigned long usecs)
+{
+ usleep (usecs);
+}
+
#ifndef DISABLE_JAVA_NET
#ifndef HAVE_SOCKLEN_T
Index: java/lang/natObject.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natObject.cc,v
retrieving revision 1.23
diff -u -r1.23 natObject.cc
--- java/lang/natObject.cc 21 Oct 2002 01:50:14 -0000 1.23
+++ java/lang/natObject.cc 19 Dec 2002 19:10:56 -0000
@@ -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 @@
#include <java/lang/Cloneable.h>
#include <java/lang/Thread.h>
+#include "platform.h"
+
#ifdef LOCK_DEBUG
# include <stdio.h>
#endif
@@ -532,7 +534,7 @@
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);
}
}