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

ios - Memory not freeing up after popping viewcontroller using ARC -

Java JSoup error fetching URL -

webstorm - PhpStorm file cache conflict with TypeScript compiler -