Skip to content

Commit

Permalink
* Allow users to define NO_JNI_DETACH_THREAD to prevent callbacks …
Browse files Browse the repository at this point in the history
…from reinitializing threads (issue #143)
  • Loading branch information
saudet committed Nov 22, 2016
1 parent 3c1fc9b commit 3abc7bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

* Allow users to define `NO_JNI_DETACH_THREAD` to prevent callbacks from reinitializing threads ([issue #143](https://github.com/bytedeco/javacpp/issues/143))

### November 13, 2016 version 1.2.5
* Add support for `decltype()` declarations to the `Parser` ([issue #135](https://github.com/bytedeco/javacpp/issues/135))
* Fix `Generator` when a `FunctionPointer` contains methods that start with "get" or "put" ([issue #137](https://github.com/bytedeco/javacpp/issues/137))
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/bytedeco/javacpp/tools/Generator.java
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,11 @@ boolean classes(boolean handleExceptions, boolean defineAdapters, boolean conver
}
if (!functions.isEmpty() || !virtualFunctions.isEmpty()) {
out.println("static JavaCPP_noinline void JavaCPP_detach(bool detach) {");
out.println("#ifndef NO_JNI_DETACH_THREAD");
out.println(" if (detach && JavaCPP_vm->DetachCurrentThread() != JNI_OK) {");
out.println(" JavaCPP_log(\"Could not detach the JavaVM from the current thread.\");");
out.println(" }");
out.println("#endif");
out.println("}");
out.println();
out.println("static JavaCPP_noinline bool JavaCPP_getEnv(JNIEnv** env) {");
Expand Down

0 comments on commit 3abc7bf

Please sign in to comment.