CCI / cci

Other
25 stars 8 forks source link

Add --enable-mutex-errorcheck option #25

Open scottatchley opened 11 years ago

scottatchley commented 11 years ago

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 pthreadmutex* 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.