202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
-
+
-
+
|
#endif
if (mutexthread == mythread) {
// We owned the lock already, so it's recursive.
pmutexPtr->counter++;
} else {
pthread_mutex_lock(&pmutexPtr->mutex);
#ifdef HAVE_PTHREAD_SPIN_LOCK
pthread_spin_lock(&pmutexPtr->lock);
pthread_spin_lock(&pmutexPtr->lock);
#endif
pmutexPtr->thread = mythread;
#ifdef HAVE_PTHREAD_SPIN_LOCK
pthread_spin_unlock(&pmutexPtr->lock);
pthread_spin_unlock(&pmutexPtr->lock);
#endif
}
}
static void
PMutexUnlock(
PMutex *pmutexPtr)
|
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
-
+
-
+
|
Tcl_Panic("mutex not owned");
}
if (pmutexPtr->counter) {
// It's recursive
pmutexPtr->counter--;
} else {
#ifdef HAVE_PTHREAD_SPIN_LOCK
pthread_spin_lock(&pmutexPtr->lock);
pthread_spin_lock(&pmutexPtr->lock);
#endif
pmutexPtr->thread = 0;
#ifdef HAVE_PTHREAD_SPIN_LOCK
pthread_spin_unlock(&pmutexPtr->lock);
pthread_spin_unlock(&pmutexPtr->lock);
#endif
pthread_mutex_unlock(&pmutexPtr->mutex);
}
}
static void
PCondWait(
|