static volatile bool running = true;
static volatile bool pwrOn = false;
static volatile bool chnl1 = true;
+static volatile bool sthchanged = false;
pthread_cond_t* wakeup;
+pthread_mutex_t* mut;
void ctrlCHandler(int signum) {
running = false;
pinMode(PWRLED, OUTPUT);
pinMode(CHNL1LED, OUTPUT);
pinMode(CHNL2LED, OUTPUT);
- pthread_mutex_t* mut = malloc (sizeof(pthread_mutex_t));
+ mut = malloc (sizeof(pthread_mutex_t));
pthread_mutex_init(mut, NULL);
wakeup = malloc(sizeof(pthread_cond_t));
pthread_cond_init(wakeup, NULL);
digitalWrite(CHNL2LED, LOW);
digitalWrite(CHNL1LED, HIGH);
}
- pthread_mutex_unlock(mut)
+ pthread_mutex_unlock(mut);
//delay(200);
//sleep(0.3);
}
printf("ShuttingDown\n");
+ pthread_cond_destroy(wakeup);
+ pthread_mutex_destroy(mut);
+ free(wakeup);
+ free(mut);
digitalWrite(PWRLED, HIGH);
digitalWrite(CHNL1LED, HIGH);
digitalWrite(CHNL2LED, HIGH);