| 12 | class TMutex::TImpl { |
| 13 | public: |
| 14 | inline TImpl() { |
| 15 | #if defined(_win_) |
| 16 | InitializeCriticalSection(&Obj); |
| 17 | #else |
| 18 | struct T { |
| 19 | pthread_mutexattr_t Attr; |
| 20 | |
| 21 | inline T() { |
| 22 | int result; |
| 23 | |
| 24 | memset(&Attr, 0, sizeof(Attr)); |
| 25 | result = pthread_mutexattr_init(&Attr); |
| 26 | if (result != 0) { |
| 27 | ythrow yexception() << "mutexattr init failed(" << LastSystemErrorText(result) << ")"; |
| 28 | } |
| 29 | |
| 30 | result = pthread_mutexattr_settype(&Attr, PTHREAD_MUTEX_RECURSIVE); |
| 31 | if (result != 0) { |
| 32 | ythrow yexception() << "mutexattr set type failed(" << LastSystemErrorText(result) << ")"; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | inline ~T() { |
| 37 | int result = pthread_mutexattr_destroy(&Attr); |
| 38 | Y_ABORT_UNLESS(result == 0, "mutexattr destroy(%s)", LastSystemErrorText(result)); |
| 39 | } |
| 40 | } pma; |
| 41 | |
| 42 | int result = pthread_mutex_init(&Obj, &pma.Attr); |
| 43 | if (result != 0) { |
| 44 | ythrow yexception() << "mutex init failed(" << LastSystemErrorText(result) << ")"; |
| 45 | } |
| 46 | #endif |
| 47 | } |
| 48 | |
| 49 | inline ~TImpl() { |
| 50 | #if defined(_win_) |
nothing calls this directly
no test coverage detected