<\/script>')

How to remove Mutex?

Using C ++, in one of my destructors, I say

mutex = NULL;

This results in a " No viable overloaded '='" error in my Xcode.

The same mutex was previously initialized in the constructor as

mutex = PTHREAD_MUTEX_INITIALIZER;

Please advise how I can properly handle this as part of a C ++ destructor

+3
source share
3 answers

You can use pthread_mutex_destroy()to destroy the mutex object.

According to the POSIX specification :

pthread_mutex_destroy() mutex; , , . pthread_mutex_destroy(), , , . , pthread_mutex_init(); undefined.

+5

pthread_mutex_destroy . , pthread_mutex_init pthread_mutex_destroy. , , , .

+3

, pthread_mutex_destroy(). ++, , PTHREAD_MUTEX_INITIALIZER, pthread_mutex_init(), , .

+2

All Articles