c++ - JNI - Java exits before native threads finish executing -


i'm in stages of developing api in c++, i'm wrapping in java using jni. native code creates socket listener thread using winapi should run indefinitely, thereby keeping program open indefinitely (tested , works fine).

however, when try invoke code in java, jvm still terminates when reaches end of main, ignoring running thread. little research has hinted java might think thread daemon rather "user thread". if that's case, can't quite figure out how convince java user thread.

does have clue this?

you need call attachcurrentthread() native threads, ensure java knows them, wait them finish.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -