Skip to content

Commit

Permalink
native: fix Thread.sleep()
Browse files Browse the repository at this point in the history
  • Loading branch information
imkiva committed May 12, 2020
1 parent cd112f4 commit 8255da9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/kivm/native/java_lang_Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include <pthread.h>
#include <csignal>
#include <chrono>
#include <thread>

using namespace kivm;

Expand Down Expand Up @@ -70,3 +72,7 @@ JAVA_NATIVE void Java_java_lang_Thread_start0(JNIEnv *env, jobject threadObject)
auto thread = new JavaThread(runMethod, {threadOop});
thread->start(threadOop);
}

JAVA_NATIVE void Java_java_lang_Thread_sleep(JNIEnv *env, jclass threadCls, jlong ms) {
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
}

0 comments on commit 8255da9

Please sign in to comment.