pthread: Fix pthread_cond_timedwait returning early from timeout

The reason timeouts would sometimes happen before the abstime deadline was due
to rounding errors converting the timeout to milliseconds, and also because
vTaskDelay(1) only delays until the next tick which is less than one full tick
period.

Closes https://github.com/espressif/esp-idf/issues/6901
This commit is contained in:
Angus Gratton
2021-05-21 19:09:33 +10:00
committed by bot
parent 3326cc852f
commit 262107691a
3 changed files with 73 additions and 7 deletions
+2
View File
@@ -94,6 +94,8 @@ Condition Variables
Static initializer constant ``PTHREAD_COND_INITIALIZER`` is supported.
* The resolution of ``pthread_cond_timedwait()`` timeouts is the RTOS tick period (see :ref:`CONFIG_FREERTOS_HZ`). Timeouts may be delayed up to one tick period after the requested timeout.
.. note:: These functions can be called from tasks created using either pthread or FreeRTOS APIs
Thread-Specific Data