remove pthread_kill/pthread_cancel from signals (if thread wasn't run, these functions cause segfault)
This commit is contained in:
parent
22097610f9
commit
e59f9a05b2
@ -73,7 +73,7 @@ void logmnt(FILE *fcoords, mountdata_t *m){
|
||||
}
|
||||
// write data
|
||||
fprintf(fcoords, "%12.6f %10.6f %10.6f %10.6f %10.6f %10.6f %10.6f %10u\n",
|
||||
m->motXposition.t, RAD2DEG(m->motXposition.val), RAD2DEG(m->motYposition.val),
|
||||
m->encXposition.t, RAD2DEG(m->motXposition.val), RAD2DEG(m->motYposition.val),
|
||||
RAD2DEG(m->encXposition.val), RAD2DEG(m->encYposition.val),
|
||||
RAD2DEG(m->encXspeed.val), RAD2DEG(m->encYspeed.val),
|
||||
m->millis);
|
||||
|
||||
@ -61,12 +61,13 @@ static FILE* fcoords = NULL;
|
||||
static pthread_t dthr;
|
||||
|
||||
void signals(int sig){
|
||||
pthread_cancel(dthr);
|
||||
if(sig){
|
||||
signal(sig, SIG_IGN);
|
||||
DBG("Get signal %d, quit.\n", sig);
|
||||
}
|
||||
DBG("Quit");
|
||||
Mount.quit();
|
||||
DBG("close");
|
||||
if(fcoords) fclose(fcoords);
|
||||
exit(sig);
|
||||
}
|
||||
|
||||
@ -75,7 +75,6 @@ static sl_option_t cmdlnopts[] = {
|
||||
};
|
||||
|
||||
void signals(int sig){
|
||||
pthread_cancel(dthr);
|
||||
if(sig){
|
||||
signal(sig, SIG_IGN);
|
||||
DBG("Get signal %d, quit.\n", sig);
|
||||
|
||||
@ -593,7 +593,7 @@ void closeSerial(){
|
||||
DBG("close encoder's fd");
|
||||
close(encfd[0]);
|
||||
encfd[0] = -1;
|
||||
if(Conf.SepEncoder == 2){
|
||||
if(Conf.SepEncoder == 2 && encfd[1] > -1){
|
||||
close(encfd[1]);
|
||||
encfd[1] = -1;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user