android/Bridge: add shutdown()

Break the mainloop and terminate run call.
This commit is contained in:
Thomas Guillem 2014-09-15 14:03:19 +02:00 committed by Max Kellermann
parent 9836b1dddd
commit 74fcbb382f
2 changed files with 10 additions and 0 deletions

View File

@ -26,4 +26,5 @@ import android.content.Context;
*/
public class Bridge {
public static native void run(Context context);
public static native void shutdown();
}

View File

@ -696,6 +696,7 @@ int mpd_main(int argc, char *argv[])
#endif
delete instance->event_loop;
delete instance;
instance = nullptr;
#ifndef ANDROID
daemonize_finish();
#endif
@ -727,4 +728,12 @@ Java_org_musicpd_Bridge_run(JNIEnv *env, jclass, jobject _context)
Environment::Deinitialise(env);
}
gcc_visibility_default
JNIEXPORT void JNICALL
Java_org_musicpd_Bridge_shutdown(JNIEnv *, jclass)
{
if (instance != nullptr)
instance->event_loop->Break();
}
#endif