From 08f643ffa18fc2911bc37f98c770eba730d8f7dd Mon Sep 17 00:00:00 2001 From: bdemsky Date: Fri, 25 Apr 2008 08:04:30 +0000 Subject: [PATCH] Add yield --- Robust/src/ClassLibrary/Thread.java | 2 ++ Robust/src/ClassLibrary/ThreadDSM.java | 2 ++ Robust/src/Runtime/thread.c | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/Robust/src/ClassLibrary/Thread.java b/Robust/src/ClassLibrary/Thread.java index 727c986d..8e790bb0 100644 --- a/Robust/src/ClassLibrary/Thread.java +++ b/Robust/src/ClassLibrary/Thread.java @@ -9,6 +9,8 @@ public class Thread { t.run(); } + public static native void yield(); + public void join() { nativeJoin(); } diff --git a/Robust/src/ClassLibrary/ThreadDSM.java b/Robust/src/ClassLibrary/ThreadDSM.java index d5c0a0ce..7c756398 100644 --- a/Robust/src/ClassLibrary/ThreadDSM.java +++ b/Robust/src/ClassLibrary/ThreadDSM.java @@ -7,6 +7,8 @@ public class Thread { threadDone = false; } + public static native void yield(); + public final native void join(); public final native void start(int mid); diff --git a/Robust/src/Runtime/thread.c b/Robust/src/Runtime/thread.c index 655a883b..00b8a6e0 100644 --- a/Robust/src/Runtime/thread.c +++ b/Robust/src/Runtime/thread.c @@ -136,6 +136,12 @@ void CALL11(___Thread______sleep____J, long long ___millis___, long long ___mill #endif } +#if defined(DSTM)||defined(THREADS) +void CALL00(___Thread______yield____) { + pthread_yield(); +} +#endif + #ifdef DSTM /* Add thread join capability */ void CALL01(___Thread______join____, struct ___Thread___ * ___this___) { -- 2.34.1