diff --git a/src/core/piinit.cpp b/src/core/piinit.cpp index 991b5a27..15f77e72 100644 --- a/src/core/piinit.cpp +++ b/src/core/piinit.cpp @@ -71,6 +71,13 @@ void __sighandler__(PISignals::Signal s) { } +#ifdef ANDROID +void android_thread_exit_handler(int sig) { + pthread_exit(0); +} +#endif + + PIInit::PIInit() { PISystemInfo * sinfo = PISystemInfo::instance(); sinfo->execDateTime = PIDateTime::current(); @@ -129,6 +136,13 @@ PIInit::PIInit() { setlocale(LC_ALL, ""); setlocale(LC_NUMERIC, "C"); # endif +#else + struct sigaction actions; + memset(&actions, 0, sizeof(actions)); + sigemptyset(&actions.sa_mask); + actions.sa_flags = 0; + actions.sa_handler = android_thread_exit_handler; + sigaction(SIGTERM, &actions, 0); #endif #ifdef PIP_ICU __syslocname__ = __sysoemname__ = 0; diff --git a/src/io/piethernet.cpp b/src/io/piethernet.cpp index 30aa91a1..aa85dff9 100755 --- a/src/io/piethernet.cpp +++ b/src/io/piethernet.cpp @@ -106,7 +106,7 @@ PIEthernet::PIEthernet(int sock_, PIString ip_port): PIIODevice("", ReadWrite) { parseAddress(ip_port, &ip_s, &port_s); sock = sock_; init_ = opened_ = connected_ = true; - setParameters(PIEthernet::ReuseAddress | PIEthernet::MulticastLoop | PIEthernet::KeepConnection); + setParameters(PIEthernet::ReuseAddress | PIEthernet::MulticastLoop); setType(TCP_Client, false); setPath(ip_port); //piCoutObj << "new tcp client" << sock_; diff --git a/src/thread/pithread.cpp b/src/thread/pithread.cpp index 0ae84c6d..1faf3bc6 100755 --- a/src/thread/pithread.cpp +++ b/src/thread/pithread.cpp @@ -181,10 +181,10 @@ void PIThread::terminate() { terminating = running_ = false; #ifndef WINDOWS # ifdef ANDROID - pthread_kill(thread, SIGKILL); + pthread_kill(thread, SIGTERM); # else //pthread_kill(thread, SIGKILL); - void * ret(0); + //void * ret(0); pthread_cancel(thread); //pthread_join(thread, &ret); # endif