Use a mutex for synchronization.

This commit is contained in:
iosen 2016-07-01 00:32:39 +10:00
parent 59ee3d5975
commit de66e2b478

View file

@ -57,7 +57,9 @@ void sntp_initialize(const struct timezone *tz) {
// To avoid div by 0 exceptions if requesting time before SNTP config // To avoid div by 0 exceptions if requesting time before SNTP config
cal = 1; cal = 1;
tim_ref = TIMER_COUNT; tim_ref = TIMER_COUNT;
vSemaphoreCreateBinary(sntp_sem); sntp_sem = xSemaphoreCreateMutex();
if (sntp_sem == NULL)
printf("sntp: mutex creation failed\n");
sntp_init(); sntp_init();
} }