Implementing pthread_mutex_lock()

Implementing pthread_mutex_lock()

Post by J de Boyne » Wed, 31 Oct 2007 00:31:00


CT> int pthread_mutex_lock(pthread_mutex_t* _this) {
CT> if (! _this->wset) {
CT> if (! detail_waitset_request(&_this->wset)) {

The first "if" test is unnecessary. Either the helper function is
performing the necessary processing to ensure that exactly one waitset
is created, or the design has a bug which the extra "if" test doesn't
fix and indeed actually exacerbates.
 
 
 

Implementing pthread_mutex_lock()

Post by Chris Thom » Wed, 14 Nov 2007 06:14:05


Yes. Your correct.