1 Star 0 Fork 20

不想上班 / jni-threadpool-c

forked from 启明南 / jni-threadpool-c 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
com_qimingnan_jni_threadpool_MyThread.c 903 Bytes
一键复制 编辑 原始数据 按行查看 历史
启明南 提交于 2020-02-06 10:45 . 伪线程测试运行成功
//
// Created by 章先生 on 2020-02-06.
//
#include "com_qimingnan_jni_threadpool_MyThread.h"
#include "common.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <assert.h>
JNIEXPORT void JNICALL Java_com_qimingnan_jni_threadpool_MyThread_run0(JNIEnv *jEnv, jobject jobj) {
JNIEnv env = *jEnv;
/* 获取MyThread字节码 */
jclass threadClass = env->GetObjectClass(jEnv, jobj);
if (NULL == threadClass) {
throwRuntimeException(jEnv, "获取线程类字节码失败");
return;
}
/* 获取线程运行函数 */
jmethodID runMethod = env->GetMethodID(jEnv, threadClass, "run", "()V");
if (NULL == runMethod) {
throwRuntimeException(jEnv, "获取线程运行函数失败");
return;
}
/* 执行线程运行函数 */
env->CallVoidMethod(jEnv, jobj, runMethod);
}
C
1
https://gitee.com/sun-wukong/jni-threadpool-c.git
git@gitee.com:sun-wukong/jni-threadpool-c.git
sun-wukong
jni-threadpool-c
jni-threadpool-c
master

搜索帮助