Install any skill in seconds. Free to start, no credit card required.
Get Started Free →google/cpp-static-thread-safety
Enforce C++ static thread safety annotations and correct synchronization primitives.
Passed 22 of 23 test cases with the skill, and 11 of 23 without it.
and 10 more in the full report
11 fixed11 passed either way1 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 11 test cases the skill fixed. Same model, same prompt, with and without the skill.
When building Filament with single-threaded configuration enabled (FILAMENT_SINGLE_THREADED), standard compile-time capability annotations must not cause compile errors. What preprocessor macro gates these annotations in compiler.h?
| Checked | Without skill | With skill |
|---|---|---|
| Identifies UTILS_HAS_THREADING as the gating macro | Missed | Passed |
The instructions your model reads when the skill loads.
Filament leverages Clang's static thread safety analysis to verify lock holding requirements at compile-time. All multi-threaded classes must use explicit capability annotations to guarantee race-free state access.
utils::Mutex & utils::Condition) — MANDATORY:
filament/ must use utils::Mutex and utils::Condition exclusively. Do not use std::mutex or std::condition_variable.utils::Mutex transparently integrates with Filament's compile-time lock debugging facility (FILAMENT_DEBUG_MUTEX / -u). When enabled, it maintains a global cycle dependency graph via BFS during lock() and try_lock(), immediately trapping lock-order inversions and self-deadlocks with exact CallStack traces. Any locks defined via std::mutex bypass this tracker entirely and remain invisible to deadlock diagnostics.linuxutil::Mutex), utils::Mutex is only 4 bytes (a single atomic futex word) versus 40 bytes for std::mutex. For structures allocated in large volumes or embedded in handles/fences, this 10x size reduction prevents struct bloat and maintains cache-line density.utils::Condition (Condition::wait / wait_until) is explicitly templated (template <typename M>) to work seamlessly with UniqueLock<utils::Mutex> for producer-consumer queues and blocking wait loops.std::mutex (pthread_mutex_t) does not provide priority inheritance out of the box (PTHREAD_PRIO_NONE). Therefore, std::mutex offers zero priority inversion protection over utils::Mutex.LockGuard const as the default for all standard synchronized blocks to guarantee scope-bound read-only lock scopes.
// Correct
utils::LockGuard const lock(mLock);
UniqueLock (non-const) strictly when passing locks to condition variables (wait(lock)) or when explicit .unlock() / .lock() boundaries are required for performance or deadlock prevention..cpp) that instantiates LockGuard or UniqueLock must explicitly include the matching utility header:
#include <utils/Mutex.h>
Clang evaluates C++ anonymous closures (lambdas) as separate context boundaries. Because lambdas lack capability attributes, standard condition variable waits passing local predicates (e.g., using std::ranges::all_of) will trigger false-positive thread safety errors.
To resolve this, use one of the following approved patterns:
Decorate only the CV wait predicate lambda operator with UTILS_NO_THREAD_SAFETY_ANALYSIS to ignore nested boundaries while preserving outer compile-time checks:
test cases passed, vs 11 / 23 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.