equal
deleted
inserted
replaced
35 |
35 |
36 static pthread_t tc_owner = 0; |
36 static pthread_t tc_owner = 0; |
37 static pthread_mutex_t tc_mutex = PTHREAD_MUTEX_INITIALIZER; |
37 static pthread_mutex_t tc_mutex = PTHREAD_MUTEX_INITIALIZER; |
38 static int tc_count = 0; |
38 static int tc_count = 0; |
39 |
39 |
40 void ThreadCritical::initialize() { |
|
41 } |
|
42 |
|
43 void ThreadCritical::release() { |
|
44 } |
|
45 |
|
46 ThreadCritical::ThreadCritical() { |
40 ThreadCritical::ThreadCritical() { |
47 pthread_t self = pthread_self(); |
41 pthread_t self = pthread_self(); |
48 if (self != tc_owner) { |
42 if (self != tc_owner) { |
49 int ret = pthread_mutex_lock(&tc_mutex); |
43 int ret = pthread_mutex_lock(&tc_mutex); |
50 guarantee(ret == 0, "fatal error with pthread_mutex_lock()"); |
44 guarantee(ret == 0, "fatal error with pthread_mutex_lock()"); |