Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --enable-mutex-errorcheck option #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

scottatchley
Copy link
Contributor

Enabling this option initializes mutexes with a
pthread_mutexattr_type of PTHREAD_MUTEX_ERRORCHECK.
All locks and unlocks will then check the return value
and abort() if there is an error.

We define these macros:

CCI_LOCK_INIT(x)
CCI_LOCK_DESTROY(x)
CCI_LOCK(x)
CCI_UNLOCK(x)

There is no need to initialize and pass a pthread_mutexattr_t
to CCI_LOCK_INIT().

This patch only alters src/api. It does not add this to any
transports.

To use them, simply replace the pthread_mutex_* with the CCI_*
equivalent. The macros cannot return a value, so do not try to
error check them. If you need error checking, use the configure
option.

Enabling this option initializes mutexes with a
pthread_mutexattr_type of PTHREAD_MUTEX_ERRORCHECK.
All locks and unlocks will then check the return value
and abort() if there is an error.

We define these macros:

CCI_LOCK_INIT(x)
CCI_LOCK_DESTROY(x)
CCI_LOCK(x)
CCI_UNLOCK(x)

There is no need to initialize and pass a pthread_mutexattr_t
to CCI_LOCK_INIT().

This patch only alters src/api. It does _not_ add this to any
transports.

To use them, simply replace the pthread_mutex_* with the CCI_*
equivalent. The macros cannot return a value, so do not try to
error check them. If you need error checking, use the configure
option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant