Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between PTHREAD_RECURSIVE_MUTEX_INITIALIZER and PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP?

Tags:

c

pthreads

When statically initializing a recursive mutex, what is the difference between

static pthread_mutex_t foo_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;

and

static pthread_mutex_t foo_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;

and why should I want the one instead of the other?

like image 232
Vincenzo Pii Avatar asked Mar 26 '13 12:03

Vincenzo Pii


1 Answers

"_NP" is meant as a hint that the feature is nonportable. In order to keep the hint there, you are best off to use the "_NP" version.

Other than that I suspect there is no difference. Not 100% sure, though.

like image 188
Owen Avatar answered Oct 12 '22 07:10

Owen