Query module LockOrder

name
Inconsistent lock sequence
description
Locking in an inconsistent sequence can lead to deadlock.
kind
problem
problem.severity
error
precision
high
id
cs/inconsistent-lock-sequence
tags
reliability correctness concurrency external/cwe/cwe-662

Imports

csharp

The default C# QL library.

Predicates

getAReachableLockStmt

Gets a lock statement reachable from a callable.

getCallTarget

Gets a call target conservatively only when there is one runtime target.

nestedLocks

Holds if there is nested pairs of lock statements, either inter-procedurally or intra-procedurally.