Call sched_yield()

Andrew Haley aph@redhat.com
Mon Jan 12 17:39:00 GMT 2009


This is a patch from a year ago that was never applied.

Andrew.


2009-01-12  Andrew Haley  <aph@redhat.com>

	* sun/misc/natUnsafe.cc (spinlock contructor): Call sched_yield().

Index: sun/misc/natUnsafe.cc
===================================================================
--- sun/misc/natUnsafe.cc	(revision 143294)
+++ sun/misc/natUnsafe.cc	(working copy)
@@ -1,6 +1,6 @@
 // natUnsafe.cc - Implementation of sun.misc.Unsafe native methods.

-/* Copyright (C) 2006
+/* Copyright (C) 2006, 2007
    Free Software Foundation

    This file is part of libgcj.
@@ -32,7 +32,7 @@
 spinlock ()
   {
     while (! compare_and_swap (&lock, 0, 1))
-      ;
+      _Jv_ThreadYield ();
   }
   ~spinlock ()
   {



More information about the Java-patches mailing list