}
}
- DBG("######### MTP TERMINATED #########");
+ DBG("Event handler terminated");
close(g_pipefd[0]);
close(g_pipefd[1]);
+ mtp_end_event();
_util_thread_exit("__thread_event_handler thread is over.");
return NULL;
long cur_time;
DBG("## Terminate all threads");
- if (g_eh_thrd) {
+ if (g_eh_thrd && g_eh_thrd != pthread_self()) {
_eh_send_event_req_to_eh_thread(EVENT_USB_REMOVED, 0, 0, NULL);
if (_util_thread_join(g_eh_thrd, NULL) == FALSE)
ERR("_util_thread_join() Fail");
g_main_loop_quit(g_mainloop);
+ if (g_eh_thrd == pthread_self())
+ _util_thread_exit("Event handler stopped itself");
+
return;
}
_eh_deregister_notification_callbacks();
media_content_disconnect();
+ DBG("######### MTP TERMINATED #########");
+
return MTP_ERROR_NONE;
}