MCPcopy Create free account
hub / github.com/catboost/catboost / TImpl

Method TImpl

util/system/mutex.cpp:14–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12class TMutex::TImpl {
13public:
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_)

Callers

nothing calls this directly

Calls 1

LastSystemErrorTextFunction · 0.70

Tested by

no test coverage detected