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