mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-10 18:24:11 +01:00
simple segfault reproduction
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1068 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
0efc69055e
commit
71589d2246
@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* small etst program whether signals between threads work as they should
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* actual test program
|
||||||
|
*/
|
||||||
|
|
||||||
|
void sighandler(int sig) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void* threadstart(void* arg) {
|
||||||
|
struct timespec timeout;
|
||||||
|
int t;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
timeout.tv_sec=0;
|
||||||
|
timeout.tv_nsec=1;
|
||||||
|
nanosleep(&timeout,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(char** argc, int argv) {
|
||||||
|
|
||||||
|
pthread_t testthread1;
|
||||||
|
struct sigaction action;
|
||||||
|
|
||||||
|
|
||||||
|
action.sa_handler=sighandler;
|
||||||
|
action.sa_flags=0;
|
||||||
|
sigfillset( &action.sa_mask );
|
||||||
|
sigaction(SIGUSR1,&action,NULL);
|
||||||
|
|
||||||
|
pthread_create(&testthread1,NULL,threadstart,NULL);
|
||||||
|
while (1) {
|
||||||
|
pthread_kill(testthread1,SIGUSR1);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user