@@ -443,12 +443,15 @@ PyThread_free_lock(PyThread_type_lock lock) |
|
|
443 |
443 |
|
444 |
444 |
dprintf(("PyThread_free_lock(%p) called\n", lock)); |
445 |
445 |
|
446 |
|
-status = pthread_mutex_destroy( &thelock->mut ); |
447 |
|
-CHECK_STATUS("pthread_mutex_destroy"); |
448 |
|
- |
|
446 |
+/* some pthread-like implementations tie the mutex to the cond |
|
447 |
+ * and must have the cond destroyed first. |
|
448 |
+ */ |
449 |
449 |
status = pthread_cond_destroy( &thelock->lock_released ); |
450 |
450 |
CHECK_STATUS("pthread_cond_destroy"); |
451 |
451 |
|
|
452 |
+status = pthread_mutex_destroy( &thelock->mut ); |
|
453 |
+CHECK_STATUS("pthread_mutex_destroy"); |
|
454 |
+ |
452 |
455 |
free((void *)thelock); |
453 |
456 |
} |
454 |
457 |
|
@@ -531,12 +534,12 @@ PyThread_release_lock(PyThread_type_lock lock) |
|
|
531 |
534 |
|
532 |
535 |
thelock->locked = 0; |
533 |
536 |
|
534 |
|
-status = pthread_mutex_unlock( &thelock->mut ); |
535 |
|
-CHECK_STATUS("pthread_mutex_unlock[3]"); |
536 |
|
- |
537 |
537 |
/* wake up someone (anyone, if any) waiting on the lock */ |
538 |
538 |
status = pthread_cond_signal( &thelock->lock_released ); |
539 |
539 |
CHECK_STATUS("pthread_cond_signal"); |
|
540 |
+ |
|
541 |
+status = pthread_mutex_unlock( &thelock->mut ); |
|
542 |
+CHECK_STATUS("pthread_mutex_unlock[3]"); |
540 |
543 |
} |
541 |
544 |
|
542 |
545 |
#endif /* USE_SEMAPHORES */ |