# FreeRTOS+POSIX supports pthread\_cond\_clockwait

**URL:** <https://forums.freertos.org/t/freertos-posix-supports-pthread-cond-clockwait/12516>\
**Category:** Kernel\
**Created:** [May 5, 2021, 9:09am UTC](https://forums.freertos.org/t/freertos-posix-supports-pthread-cond-clockwait/12516 "2021-05-05T09:09:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![easonlai](https://avatars.discourse-cdn.com/v4/letter/e/4bbf92/32.png) [@easonlai](https://forums.freertos.org/u/easonlai)\
**Post date:** [May 5, 2021, 9:09am UTC](https://forums.freertos.org/t/freertos-posix-supports-pthread-cond-clockwait/12516/1 "2021-05-05T09:09:18Z")

</div>

Hello forum,

`pthread_cond_clockwait` is a key API to fix a bug in GCC10.  
Please reference to GCC bug PR: 41861

So… Could I know is there any plan to support pthread\_cond\_clockwait() API on FreeRTOS roadmap? Thank you.

Best regards!

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [May 5, 2021, 3:08pm UTC](https://forums.freertos.org/t/freertos-posix-supports-pthread-cond-clockwait/12516/2 "2021-05-05T15:08:44Z")

</div>

It is not something under consideration at the moment. Can you provide an implementation then upstream it with a pull request?

---

<div class="post-metadata">

**Author:** ![cobusve](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/cobusve/32/1447_2.png) [@cobusve](https://forums.freertos.org/u/cobusve)\
**Post date:** [May 10, 2021, 9:04pm UTC](https://forums.freertos.org/t/freertos-posix-supports-pthread-cond-clockwait/12516/3 "2021-05-10T21:04:01Z")

</div>

Hi easonai,

Since there are some fundamental differences between how pthreads work in POSIX and what we do in FreeRTOS it is unlikely that we will be able to implement all functions in FreeRTOS+POSIX.

Like Richard said we do not have any plans to add something like pthread\_cond\_clockwait to FreeRTOS+POSIX at this time. There are also a large number of other functions we are not planning to add particulary for example everything to do with thread cancellation since FreeRTOS does not have cancellation points as required by POSIX.

I looked at the bug you listed, PR 41861 and it seems like this has to do with monotonic clocks not being the right choice because the epoch is not necessarily known to be the same as the system clock, but since we do not have any functionality like this in FreeFTOS I expect that if you need this work-around this will be only the beginning of your troubles here.

It looks like you are wanting to sleep a thread until a specific point in the future, may I suggest you use a timer to do that instead? You could use a task notification or a mutex to wake a sleeping task from a timer like this.

I think the intent of FreeRTOS+POSIX was mostly to give a familiar interface for people to create tasks using the POSIX ptread\_create interface and perhaps do a couple of other things more easily, but I do not think it is feasible to have a complete POSIX implementation.

Cobus
