Skip to content

Commit

Permalink
[summary] reslove performance problem of detach (#184)
Browse files Browse the repository at this point in the history
Co-authored-by: ahxiao <[email protected]>
  • Loading branch information
Hopshine and ahxiao authored Oct 7, 2023
1 parent eabad8c commit 89a1247
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static void on_receive_rpc_response(struct bcos_sdk_c_struct_response* resp)
delete context;

JNIEnv* env;
jvm->AttachCurrentThread((void**)&env, NULL);
jvm->AttachCurrentThreadAsDaemon((void**)&env, NULL);

std::string className = "org/fisco/bcos/sdk/jni/common/Response";
std::string onRespSig = "(Lorg/fisco/bcos/sdk/jni/common/Response;)V";
Expand Down Expand Up @@ -108,9 +108,6 @@ static void on_receive_rpc_response(struct bcos_sdk_c_struct_response* resp)

// release callback global reference
env->DeleteGlobalRef(jcallback);

// detach current thread when job finished
jvm->DetachCurrentThread();
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static void on_receive_tars_rpc_response(struct bcos_sdk_c_struct_response* resp
delete context;

JNIEnv* env;
jvm->AttachCurrentThread((void**)&env, NULL);
jvm->AttachCurrentThreadAsDaemon((void**)&env, NULL);

std::string className = "org/fisco/bcos/sdk/jni/common/Response";
std::string onRespSig = "(Lorg/fisco/bcos/sdk/jni/common/Response;)V";
Expand Down Expand Up @@ -109,9 +109,6 @@ static void on_receive_tars_rpc_response(struct bcos_sdk_c_struct_response* resp

// release callback global reference
env->DeleteGlobalRef(jcallback);

// detach current thread when job finished
jvm->DetachCurrentThread();
}

/*
Expand Down

0 comments on commit 89a1247

Please sign in to comment.