| 50 | pthread_mutexattr_t Mutex::attr; |
| 51 | |
| 52 | void Mutex::initMutexes() |
| 53 | { |
| 54 | static std::once_flag onceFlag; |
| 55 | std::call_once(onceFlag, [] { |
| 56 | // Throw exceptions on errors, but they will not be processed in init |
| 57 | // (first constructor). Better logging facilities are required here. |
| 58 | int rc = pthread_mutexattr_init(&attr); |
| 59 | if (rc < 0) |
| 60 | system_call_failed::raise("pthread_mutexattr_init", rc); |
| 61 | |
| 62 | rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); |
| 63 | if (rc < 0) |
| 64 | system_call_failed::raise("pthread_mutexattr_settype", rc); |
| 65 | }); |
| 66 | } |
| 67 | |
| 68 | #endif |
| 69 | |