Use a mutex for synchronization.
This commit is contained in:
parent
59ee3d5975
commit
de66e2b478
1 changed files with 3 additions and 1 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue