FreeRTOS+POSIX supports pthread_cond_clockwait

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!

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

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