Home > Software design >  What is the behaviour of calling pthread_mutex_lock and pthread_mutex_unlock with NULL?
What is the behaviour of calling pthread_mutex_lock and pthread_mutex_unlock with NULL?

Time:01-30

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

CodePudding user response:

Read the manual. It clearly states:

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.

If you are experienced with C you probably know what that means: Don't do it!

  •  Tags:  
  • Related