sqc 0.4.13

Software Code Quality - CERT C compliance checker
[metadata]
id = "POS52-C"
type = "rule"
category = "POS"
number = 52
title = "Do not perform operations that can block while holding a POSIX lock"
description = """
If a lock is being held and an operation that can block is performed, any other
thread that needs to acquire that lock may also block. This condition can
degrade the performance of a system or cause a deadlock to occur. Blocking calls
include, but are not limited to: network, file, and console I/O. This rule is a
specific instance ofCON05-C. Do not perform operations that can block while
holding a lockusing POSIX threads. This noncompliant code example demonstrates
an occurrence of a blocking call that waits to receive data on a socket while a
mutex is locked. Therecv()call blocks until data arrives on the socket. While it
is blocked, other threads that are waiting for the lock are also blocked.
"""
severity = "Low"
likelihood = "Probable"
priority = "P2"
level = "L3"
cert_version = "2016 Edition (Wiki)"
last_modified = "Oct 31, 2025"

[rules.cert_c.POS52-C]
enabled = true

[references]
wiki = "https://wiki.sei.cmu.edu/confluence/display/c/POS52-C.+Do+not+perform+operations+that+can+block+while+holding+a+POSIX+lock"
cwe = ["CWE-557"]