These checkers detect issues related to multitasking code such as data races where multiple tasks operate on an unprotected variable, or locking defects where critical sections are involved in a deadlock. Polyspace can detect thread and critical sections in your code, or you can manually define those in the Polyspace configuration.
|Multiple tasks perform unprotected nonatomic operations on shared variable|
|Multiple threads perform unprotected operations on adjacent bit fields of a shared data structure (Since R2020b)|
|Multiple tasks make unprotected calls to thread-unsafe standard library function|
Incorrect Lock/Unlock or Mutex Usage
|Task performs lengthy operation while holding a lock|
|Call sequence to lock functions cause two tasks to block each other|
|Task tries to destroy a mutex in the locked state|
|Lock function is called twice in a task without an intermediate call to unlock function|
|Unlock function is called twice in a task without an intermediate call to lock function|
|Unlock function without lock function|
|Lock function without unlock function|
|Threads using different mutexes when concurrently waiting on the same condition variable is undefined behavior (Since R2020a)|
Improper Thread Creation, Joining, or Destruction
|Calling thread might be cancelled in an unsafe state (Since R2020a)|
|Thread that was previously joined or detached is joined or detached again (Since R2019b)|
|Duplicated initialization of thread attributes or noninitialized thread attribute used in functions that expect initialized attributes (Since R2019b)|
|Program with multiple threads uses |
|Uncaught signal kills entire process instead of specific thread|
|Thread ID from failed thread creation used in subsequent thread functions (Since R2019b)|
Memory Escape from Threads
|Variable is passed from one thread to another without ensuring that variable stays alive through duration of latter thread (Since R2020a)|
|Dynamically allocated thread-specific memory not freed before end of thread|
|Variable accessible between load and store operations|
|Variable can be modified between accesses|
|Loop checks failure condition after possible spurious failure|
|Loop checks wake-up condition after possible spurious wake-up|
- Bug Finder Defect Groups
The Bug Finder defect checkers are classified into groups such as data flow, concurrency, numerical, and so on.
- Analyze Multitasking Programs in Polyspace
Detect data races or deadlocks with Bug Finder, or see a comprehensive analysis of shared variable usage with Code Prover.
- Protections for Shared Variables in Multitasking Code
Protect shared variables by using critical section, temporal exclusion, priorities, or interrupt disabling.