Java: call JNI AttachCurrentThread less frequently.

Each call to AttachCurrentThread results in a new Java thread object being
created.  This is inefficient and also causes debugging issues with Eclipse
due to constant creation and removal of threads.  Now AttachCurrentThread is
only called once for (all) listeners and once for logging (if used).
This commit is contained in:
Peter Johnson
2015-12-20 20:42:09 -08:00
parent b4c0583896
commit 32001427d4
7 changed files with 248 additions and 71 deletions

View File

@@ -167,6 +167,14 @@ void NT_Flush(void) { nt::Flush(); }
* Callback Creation Functions
*/
void NT_SetListenerOnStart(void (*on_start)(void *data), void *data) {
nt::SetListenerOnStart([=]() { on_start(data); });
}
void NT_SetListenerOnExit(void (*on_exit)(void *data), void *data) {
nt::SetListenerOnExit([=]() { on_exit(data); });
}
unsigned int NT_AddEntryListener(const char *prefix, size_t prefix_len,
void *data,
NT_EntryListenerCallback callback,