Actions
Bug #2763
closedpthread_mutex_destroy fails with error EINVAL(22) when run from main thread
Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
01/08/2015
Due date:
% Done:
0%
Estimated time:
Description
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
Actions