jlaitine commented on code in PR #16194:
URL: https://github.com/apache/nuttx/pull/16194#discussion_r2043740058
##########
include/semaphore.h:
##########
@@ -104,8 +104,16 @@ struct semholder_s
struct sem_s
{
- volatile int32_t semcount; /* >0 -> Num counts available */
- /* <0 -> Num tasks waiting for semaphore */
+ union
+ {
+ volatile int32_t semcount; /* >0 -> Num counts available */
+ /* <0 -> Num tasks waiting for semaphore
*/
+ volatile uint32_t mholder; /* == NXMUTEX_NO_HOLDER -> mutex has no
holder */
Review Comment:
Ok, decided to keep it like this for now, explanation below. I think that
mutex holder is *not* an integer, but it is essentially a bit-field (but due to
bitfield ordering is not standard, it is just managed via bitwise
oprations/macros).
So changing that to int32 would be just confusing, I don't really like the
obscure way of first setting the highest bit manually and later checking that
the int has become negative. Obviously works, but again, mholder is not an
integer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]