[DragonFlyBSD - Bug #2763] (Resolved) pthread_mutex_destroy fails with error EINVAL(22) when run from main thread

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Thu Jan 8 15:44:22 PST 2015


Issue #2763 has been updated by mneumann.

Status changed from New to Resolved

Fixed with commit http://gitweb.dragonflybsd.org/dragonfly.git/commit/146da5fcd4be3d6b3e74514ab38418637b600540.

----------------------------------------
Bug #2763: pthread_mutex_destroy fails with error EINVAL(22) when run from main thread
http://bugs.dragonflybsd.org/issues/2763#change-12399

* Author: mneumann
* Status: Resolved
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
----------------------------------------
The following program when compiled with -pthread on DragonFly fails with assertion 22, while it works on Linux:

#include <assert.h>
#include <pthread.h>

int main() {
  pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
  assert(pthread_mutex_destroy(&lock) == 0); // returns EINVAL (22)
}

While when it goes through a lock/unlock cycle or pthread_mutex_init() is called before,
the pthread_mutex_destroy() does not fail with EINVAL:

int main() {
  pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
  pthread_mutex_init(&lock, NULL);
  assert(pthread_mutex_destroy(&lock) == 0); // OK
}

I propose the attached patch to return success if pthread_mutex_destroy() is called 
for the PTHREAD_MUTEX_INITIALIZER case.


---Files--------------------------------
diff-thread.txt (493 Bytes)


-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account



More information about the Bugs mailing list