I've found here https://stackoverflow.com/a/12901159/6655884 a function call where it attaches the thread with AttachCurrentThread
, does the call and then detaches it with DetachCurrentThread
.
I want to know if this process is costly. I have a C++ function
void sendEvent(Event event) {
//call java function here
}
that will be called by several C++ threads to send events to the Java side, so I cannot simply attach a thread and never detach it because many different threads are going to call sendEvent
. So I wanna know if doing AttachCurrentThread
, calling Java and then DetachCurrentThread
at every sendEvent
call is costly. If it is, what should I do instead?