Since the PTHREAD_COND_INITIALIZER is actually a structure initializer, it may be used to initialize a condition variable only when it is declared.
From: Multi-Threaded Programming With POSIX Threads
Question: Couldn’t understand the above quote.
It is just a macro, why can’t I use it to initialize the condition variable on run time?
What has its being a structure initializer to do with anything?
Because it is a structure initializer, you cannot use it to init the structure in a statement apart from its declaration.
It is defined on my system like so:
Expanded and used, we see:
That is,
expands to: