I wrote the following minimal example:
#include
#include
#include
#define SUCCESS 0
using namespace std;
int main() {
int res;
pthread_mutex_t t;
pthread_mutex_init(&t, NULL);
res = pthread_mutex_lock(&t);
res = pthread_mutex_destroy(&t);
if (res != SUCCESS)
{
cout << "Failed to delete: " << strerror(res) << " # " << t.__data.__lock << " " << t.__data.__nusers << endl;
}
else
{
cout << "Deleted!"<< endl;
}
res = pthread_mutex_unlock(&t);
cout << res << endl;
pthread_exit(NULL);
return 0;
}
Also at ideone
On one side as som