]> granicus.if.org Git - esp-idf/commit
freertos: use xTaskQueueMutex to protect tick count
authorIvan Grokhotkov <ivan@espressif.com>
Fri, 12 Oct 2018 06:18:49 +0000 (14:18 +0800)
committerbot <bot@espressif.com>
Mon, 5 Nov 2018 03:08:26 +0000 (03:08 +0000)
commitb7841ec3138a0426cf201ffc18466455b4975b91
tree0af8e97f24ee8a1e7b708a82b11215ca105dae1e
parent4f4bed5e6591bc59dc9207676d123e2093b2ced9
freertos: use xTaskQueueMutex to protect tick count

Having two different spinlocks is problematic due to possibly
different order in which the locks will be taken. Changing the order
would require significant restructuring of kernel code which is
undesirable.

An additional place where taking xTickCountMutex was needed was in
vApplicationSleep function. Not taking xTickCountMutex resulted in
other CPU sometimes possibly advancing tick count while light sleep
entry/exit was happening. Taking xTickCountMutex in addition to
xTaskQueueMutex has shown a problem that in different code paths,
these two spinlocks could be taken in different order, leading to
(unlikely, but possible) deadlocks.
components/freertos/tasks.c