mirror of
https://github.com/corda/corda.git
synced 2025-01-09 14:33:30 +00:00
implement Thread.yield
This commit is contained in:
parent
9ef9d9619d
commit
aa9c887fb4
@ -579,6 +579,13 @@ Avian_java_lang_Thread_enumerate
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT void JNICALL
|
||||||
|
Avian_java_lang_Thread_yield
|
||||||
|
(Thread* t, object, uintptr_t*)
|
||||||
|
{
|
||||||
|
t->m->system->yield();
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
Avian_avian_Classes_acquireClassLock
|
Avian_avian_Classes_acquireClassLock
|
||||||
(Thread* t, object, uintptr_t*)
|
(Thread* t, object, uintptr_t*)
|
||||||
|
@ -2210,13 +2210,9 @@ EXPORT(JVM_SetThreadPriority)(Thread*, jobject, jint)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT void JNICALL
|
extern "C" JNIEXPORT void JNICALL
|
||||||
EXPORT(JVM_Yield)(Thread*, jclass)
|
EXPORT(JVM_Yield)(Thread* t, jclass)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_WINDOWS
|
t->m->system->yield();
|
||||||
SwitchToThread();
|
|
||||||
#else
|
|
||||||
sched_yield();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t
|
uint64_t
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "sys/ucontext.h"
|
#include "sys/ucontext.h"
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
#include "dirent.h"
|
#include "dirent.h"
|
||||||
|
#include "sched.h"
|
||||||
|
|
||||||
#include "arch.h"
|
#include "arch.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
@ -795,6 +796,10 @@ class MySystem: public System {
|
|||||||
(static_cast<int64_t>(tv.tv_usec) / 1000);
|
(static_cast<int64_t>(tv.tv_usec) / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void yield() {
|
||||||
|
sched_yield();
|
||||||
|
}
|
||||||
|
|
||||||
virtual void exit(int code) {
|
virtual void exit(int code) {
|
||||||
::exit(code);
|
::exit(code);
|
||||||
}
|
}
|
||||||
|
@ -141,6 +141,7 @@ class System {
|
|||||||
virtual char pathSeparator() = 0;
|
virtual char pathSeparator() = 0;
|
||||||
virtual char fileSeparator() = 0;
|
virtual char fileSeparator() = 0;
|
||||||
virtual int64_t now() = 0;
|
virtual int64_t now() = 0;
|
||||||
|
virtual void yield() = 0;
|
||||||
virtual void exit(int code) = 0;
|
virtual void exit(int code) = 0;
|
||||||
virtual void abort() = 0;
|
virtual void abort() = 0;
|
||||||
virtual void dispose() = 0;
|
virtual void dispose() = 0;
|
||||||
|
@ -807,6 +807,10 @@ class MySystem: public System {
|
|||||||
| time.dwLowDateTime) / 10000) - 11644473600000LL;
|
| time.dwLowDateTime) / 10000) - 11644473600000LL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void yield() {
|
||||||
|
SwitchToThread();
|
||||||
|
}
|
||||||
|
|
||||||
virtual void exit(int code) {
|
virtual void exit(int code) {
|
||||||
::exit(code);
|
::exit(code);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user