pthread_mutex_t mutex;would yield a usable mutex.
pthread_mutex_init(&mutex, NULL);
Yet this is not always the case: on denx/PPC 440 strange things can happen (see the previous post When Classes Instantiated as auto Vars on Stack are Evil).
It turns out that the "correct" code sequence is
pthread_mutex_t mutex;otherwise under some circumstances (e.g. mutexes ending up on the stack in the belly of an Object) one would have pthread_mutex_lock block on this mutex forever at the first invocation.
memset(&mutex, 0, sizeof(mutex)); // Voodoo for PPC
pthread_mutex_init(&mutex, NULL);
-ulianov