From de66e2b4781dd83422b1311837b9b1e03f3656e0 Mon Sep 17 00:00:00 2001 From: iosen Date: Fri, 1 Jul 2016 00:32:39 +1000 Subject: [PATCH] Use a mutex for synchronization. --- extras/sntp/sntp_fun.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/sntp/sntp_fun.c b/extras/sntp/sntp_fun.c index 1c738cc..c480ae1 100644 --- a/extras/sntp/sntp_fun.c +++ b/extras/sntp/sntp_fun.c @@ -57,7 +57,9 @@ void sntp_initialize(const struct timezone *tz) { // To avoid div by 0 exceptions if requesting time before SNTP config cal = 1; tim_ref = TIMER_COUNT; - vSemaphoreCreateBinary(sntp_sem); + sntp_sem = xSemaphoreCreateMutex(); + if (sntp_sem == NULL) + printf("sntp: mutex creation failed\n"); sntp_init(); }