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 -

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -