sys/threads: assert on uninitialized mutex/cond handles#489
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a static inline helper function handleIsValid to validate resource handles in sys/threads.c. It also adds assertions using this helper to verify the validity of handles in mutexLock, condWait, and mutexLock2. There are no review comments, and I have no additional feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Unit Test Results9 002 tests - 1 858 8 350 ✅ - 1 840 50m 36s ⏱️ - 1m 16s For more details on these failures, see this check. Results for commit 460afc1. ± Comparison against base commit 8ff4671. This pull request removes 1944 and adds 86 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
This is first step in improving detection of uninitialized handles. Adding checks to non DEBUG builds needs to be considered, but requires more care before it can be safely adopted.
41a8cb7 to
460afc1
Compare
This is first step in improving detection of uninitialized handles. Adding checks to non DEBUG builds needs to be considered, but requires more care before it can be safely adopted.
Motivation and Context
mutexLockis frequently used without checking return value. If mutex create is not invoked then allmutexLockinvocations are silently ignored without any sign that locks are never actually held.Types of changes
How Has This Been Tested?
Checklist:
Special treatment