使用 NULL 调用 pthread_mutex_lock 和 pthread_mutex_unlock 的行为是什么?

What is the behaviour of calling pthread_mutex_lock and pthread_mutex_unlock with NULL?

以 NULL 作为参数调用 pthread_mutex_lock 和 pthread_mutex_unlock 的行为是什么?

阅读manual。它明确指出:

If mutex does not refer to an initialized mutex object, the behavior of pthread_mutex_lock(), pthread_mutex_trylock(), and pthread_mutex_unlock() is undefined.

如果您熟悉 C,您可能知道这意味着什么:不要这样做!