JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc
C and C++

Concurrency Models: Blocking Functions

Blocking functions don't allow their calling process to continue until they return, but can take a long time to do so: many wait for external events of some kind. A call to a function that is modeled as a blocking function will trigger a Blocking in Critical Section warning if the calling process is holding a lock.



Blocking Functions

CodeSonar ships with library models that allow it to recognize various blocking functions. Some examples are listed below.

Blocking functions recognized include...
CMX-RTX K_Event_Wait()
FreeRTOS vTaskDelay()
libc sleep()
Netscape Portable Runtime (NSPR) PR_CWait()
Win32 Sleep()

Creating New Models

If you are authoring a model for a blocking function, it is usually best to have the model call the already-modeled function that is most similar. This will ensure that CodeSonar correctly treats the function as blocking, and includes it in the appropriate checks.

If no existing model is appropriate, write your model using the extension functions provided. In particular, your model should call csonar_blocking_function(): see the function documentation for an annotated example.

 

To report problems with this documentation, please visit https://support.codesecure.com/.