linux signal
This commit is contained in:
@@ -248,6 +248,10 @@
|
|||||||
typedef long time_t;
|
typedef long time_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef POSIX_SIGNALS
|
||||||
|
# define PIP_INTERRUPT_SIGNAL SIGTERM
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
# define environ __environ
|
# define environ __environ
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -104,7 +104,8 @@ void pipInitThreadSignals() {
|
|||||||
sigemptyset(&actions.sa_mask);
|
sigemptyset(&actions.sa_mask);
|
||||||
actions.sa_flags = 0;
|
actions.sa_flags = 0;
|
||||||
actions.sa_handler = pipThreadSignalHandler;
|
actions.sa_handler = pipThreadSignalHandler;
|
||||||
sigaction(SIGUSR2, &actions, 0);
|
if (sigaction(PIP_INTERRUPT_SIGNAL, &actions, 0) != 0)
|
||||||
|
piCout << "sigaction error:" << errorString();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -608,7 +608,7 @@ void PIThread::interrupt() {
|
|||||||
QueueUserAPC(winThreadAPC, PRIVATE->thread, 0);
|
QueueUserAPC(winThreadAPC, PRIVATE->thread, 0);
|
||||||
#else
|
#else
|
||||||
# ifdef POSIX_SIGNALS
|
# ifdef POSIX_SIGNALS
|
||||||
pthread_kill(PRIVATE->thread, SIGUSR2);
|
pthread_kill(PRIVATE->thread, PIP_INTERRUPT_SIGNAL);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
6
main.cpp
6
main.cpp
@@ -80,7 +80,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char * argv[]) {
|
int main(int argc, char * argv[]) {
|
||||||
piCout << "main" << GetCurrentThreadId();
|
piCout << "main";
|
||||||
|
|
||||||
/*for (int i = 0; i < count; ++i)
|
/*for (int i = 0; i < count; ++i)
|
||||||
pipes[i].create();
|
pipes[i].create();
|
||||||
@@ -109,8 +109,8 @@ int main(int argc, char * argv[]) {
|
|||||||
delete threads[i];
|
delete threads[i];
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
PIEthernet eth(PIEthernet::TCP_Client), seth(PIEthernet::TCP_Client);
|
PIEthernet eth(PIEthernet::UDP), seth(PIEthernet::TCP_Client);
|
||||||
eth.connect("192.168.1.13", 22);
|
eth.connect("127.0.0.1", 50000);
|
||||||
eth.startThreadedRead();
|
eth.startThreadedRead();
|
||||||
//piCout << eth.open();
|
//piCout << eth.open();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user