eclipse-threadx / threadx

Eclipse ThreadX is an advanced real-time operating system (RTOS) designed specifically for deeply embedded applications.
https://github.com/eclipse-threadx/rtos-docs/blob/main/rtos-docs/threadx/index.md
MIT License
2.96k stars 801 forks source link

Comment on posix condition variable implementation looks bogus #419

Open wucke13 opened 6 days ago

wucke13 commented 6 days ago

https://github.com/eclipse-threadx/threadx/blob/485a02faec6edccef14812ddce6844af1d7d2eef/utility/rtos_compatibility_layers/posix/px_cond_signal.c#L92

fdesbiens commented 6 days ago

Thanks for raising this issue, @wucke13.

Looking at the code, I think the comment should read:

Simply convert the condition variable control block into a semaphore pointer.

What do you think?

jserv commented 6 days ago

The comment can be refined as following:

--- a/utility/rtos_compatibility_layers/posix/px_cond_signal.c
+++ b/utility/rtos_compatibility_layers/posix/px_cond_signal.c
@@ -89,7 +89,7 @@ TX_SEMAPHORE        *semaphore_ptr;
 UINT                 status;

     /* Get the condition variable's internal semaphore.  */
-    /* Simply convert the COndition variable control block into a semaphore  a cast */ 
+    /* Simply convert the condition variable control block into a semaphore using casting */
     semaphore_ptr = (&( cond->cond_semaphore ));
     if ( semaphore_ptr->tx_semaphore_suspended_count)
     {
wucke13 commented 5 days ago

Seems sensible to me!