[cpp]
pthread_mutex_t *m = new pthread_mutex_t;
pthread_mutex_init(m, NULL);
使用结束后调用:
[cpp]
pthread_mutex_destroy(m);
那么我是否需要调用 free(m)
答:
为什么呢?
因为下面的调用方法是被允许的:
[cpp]
pthread_mutex_t m;
pthread_mutex_init(&m, NULL);
pthread_mutex_destroy(&m); /* Can't free &m. 这里是引用*/