Actually we are calling AttachCurrentThread and DetachCurrentThread inside the logger_handler function (https://github.com/roc-project/roc-java/blob/master/roc_jni/src/main/cpp/logger.cpp);
As it has been discussed at #18 this can slow down performances.
A more efficient solution would involve detaching thread just before its exit, as it's described at https://developer.android.com/training/articles/perf-jni#threads:
you can use pthread_key_create() to define a destructor function that will be called before the thread exits, and call DetachCurrentThread() from there. (Use that key with pthread_setspecific() to store the JNIEnv in thread-local-storage).
Actually we are calling
AttachCurrentThreadandDetachCurrentThreadinside thelogger_handlerfunction (https://github.com/roc-project/roc-java/blob/master/roc_jni/src/main/cpp/logger.cpp);As it has been discussed at #18 this can slow down performances.
A more efficient solution would involve detaching thread just before its exit, as it's described at https://developer.android.com/training/articles/perf-jni#threads: