Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Pthread mutual exclusion (mutex) locks are used to avoid simultaneous usage of common resources. Several types of mutex locks are defined by pthreads: NORMAL, ERRORCHECK, RECURSIVE, and DEFAULT.

Wiki Markup
POSIX definesdescribes PTHREAD_MUTEX_NORMAL locks toas havehaving the following undefined behavior \[[Open Group 4|https://www.securecoding.cert.org/confluence/display/seccode/AA.+C+References#AA.CReferences-OpenGroup04]\]:

...

This compliant solution shows an ERRORCHECK mutex lock being created where so that return codes will be available during locking and unlocking.

...