调用pthread_mutex_destroy之后是否需要free
翻译自:http://stackoverflow.com/questions/6883032/do-i-need-to-use-delete-after-pthread-mutex-destroy
问:
假设我有以下代码来初始化互斥变量:
pthread_mutex_t m;pthread_mutex_init(&m, NULL);pthread_mutex_destroy(&m); /* Can't free &m. 这里是引用*/你可能传入一个指针,也可能传入引用,函数并不能区分,因此,如果你声明的是指针,则需要手动free