1 /* -*- Mode: C++; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // -------------------------------------------------------------------------*/
10 #include "squirreljme.h"
12 #define WAITFORUPDATE_DESC "(I)Z"
14 JNIEXPORT jint JNICALL
Impl_mle_ThreadShelf_aliveThreadCount(JNIEnv
* env
,
15 jclass classy
, jboolean includeMain
, jboolean includeDaemon
)
17 return forwardCallStaticInteger(env
,
18 "cc/squirreljme/emulator/NativeThreadShelf",
19 "aliveThreadCount", "(ZZ)I", includeMain
, includeDaemon
);
22 JNIEXPORT jobject JNICALL
Impl_mle_ThreadShelf_currentJavaThread(JNIEnv
* env
,
25 return forwardCallStaticObject(env
, "java/lang/Thread",
26 "currentThread", "()Ljava/lang/Thread;");
29 JNIEXPORT
void JNICALL
Impl_mle_ThreadShelf_javaThreadSetDaemon(JNIEnv
* env
,
30 jclass classy
, jobject javaThread
)
32 forwardCallStaticVoid(env
, "cc/squirreljme/emulator/NativeThreadShelf",
33 "javaThreadSetDaemon", "(Ljava/lang/Thread;)V", javaThread
);
36 JNIEXPORT
void JNICALL
Impl_mle_ThreadShelf_setTrace(JNIEnv
* env
,
37 jclass classy
, jint fd
, jobject string
, jobject array
)
42 JNIEXPORT jboolean JNICALL
Impl_mle_ThreadShelf_waitForUpdate(JNIEnv
* env
,
43 jclass classy
, jint msWait
)
46 return forwardCallStaticBoolean(env
,
47 "cc/squirreljme/emulator/NativeThreadShelf",
48 "waitForUpdate", WAITFORUPDATE_DESC
,
52 static const JNINativeMethod mleThreadMethods
[] =
54 {"aliveThreadCount", "(ZZ)I",
55 (void*)Impl_mle_ThreadShelf_aliveThreadCount
},
56 {"currentJavaThread", "()Ljava/lang/Thread;",
57 (void*)Impl_mle_ThreadShelf_currentJavaThread
},
58 {"javaThreadSetDaemon", "(Ljava/lang/Thread;)V",
59 (void*)Impl_mle_ThreadShelf_javaThreadSetDaemon
},
60 {"setTrace", "(Ljava/lang/String;[Lcc/squirreljme/jvm/mle/brackets/TracePointBracket;)V",
61 (void*)Impl_mle_ThreadShelf_setTrace
},
62 {"waitForUpdate", WAITFORUPDATE_DESC
,
63 (void*)Impl_mle_ThreadShelf_waitForUpdate
},
66 jint JNICALL
mleThreadInit(JNIEnv
* env
, jclass classy
)
68 return (*env
)->RegisterNatives(env
,
69 (*env
)->FindClass(env
, "cc/squirreljme/jvm/mle/ThreadShelf"),
70 mleThreadMethods
, sizeof(mleThreadMethods
) /
71 sizeof(JNINativeMethod
));