mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user