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:
#define PTHREAD_COND_INITIALIZER {_PTHREAD_COND_SIG_init, {0}}
Expanded and used, we see:
pthread_cond_t p = PTHREAD_COND_INITIALIZER; // << ok! p = PTHREAD_COND_INITIALIZER; // << compiler error =\
That is,
p = PTHREAD_COND_INITIALIZER;
expands to:
p = {_PTHREAD_COND_SIG_init, {0}};
Related Posts:
- What’s the difference between deadlock and livelock?
- What is a mutex?
- What is a race condition?
- pthread_join() and pthread_exit()
- What is a “thread” (really)?
- What’s a Pthread?
- Undefined reference to pthread_create in Linux
- What is the difference between a process and a thread?
- What is the meaning of the term “thread-safe”?
- What are atomic operations for newbies?
- How to use multiprocessing queue in Python?
- Multiprocessing vs Threading Python
- pthread sleep linux
- Android “Only the original thread that created a view hierarchy can touch its views.”
- Proper use of mutexes in Python
- What does threadsafe mean?
- How to avoid Not on FX application thread; currentThread = JavaFX Application Thread error?
- Java Wait for thread to finish
- Semaphore vs. Monitors – what’s the difference?
- Difference between volatile and synchronized in Java
- Can I get Unix’s pthread.h to compile in Windows?
- Difference between user-level and kernel-supported threads?
- software threads vs hardware threads
- Python time.sleep() vs event.wait()
- Mutex example / tutorial? [closed]
- Undefined reference to pthread_create
- How to print pthread_t
- What exactly is std::atomic?
- Program received signal SIGPIPE, Broken pipe
- C++ terminate called without an active exception
- Thread pooling in C++11
- No enclosing instance of type is accessible.
- Timeout on a function call
- Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on
- The calling thread cannot access this object because a different thread owns it
- What does java.lang.Thread.interrupt() do?
- Is there any way to kill a Thread?
- Why does PyQt crashes without information? (exit code 0xC0000409)
- Why does PyQt crashes without information? (exit code 0xC0000409)
- PyQt is thread-safe to the same extent that Qt is thread-safe. The Qt docs will tell you which parts of their API are guaranteed to be so, and under what circumstances.
- How to pause / sleep thread or process in Android?
- local variables referenced from an inner class must be final or effectively final
- Why doesn’t JavaScript support multithreading?
- java.lang.IllegalMonitorStateException: object not locked by thread before wait()?
- WSACancelBlockingCall exception
- cast to pointer from integer of different size, pthread code
- The application may be doing too much work on its main thread
- Task vs Thread differences
- Still Reachable Leak detected by Valgrind
- How to use WPF Background Worker
- How can I wait for a thread to finish with .NET?
- OpenMP set_num_threads() is not working
- How to “wait” a Thread in Android
- java.lang.IllegalThreadStateException
- PTHREAD_MUTEX_INITIALIZER vs pthread_mutex_init ( &mutex, param)
- Service vs IntentService in the Android platform
- When should you use multithreading? And would multi threading be beneficial if the different threads execute mutually independent tasks?
- Difference between volatile and synchronized in Java