VERSIONS top pthread_mutexattr_getrobust() and pthread_mutexattr_setrobust() In the glibc implementation, pthread_mutexattr_getrobust() alwaysĮRRORS top EINVAL A value other than PTHREAD_MUTEX_STALLED or Object that was initialized by pthread_mutexattr_init(3), Pthread_mutexattr_setrobust() should refer to a mutex attributes Note that the attr argument of pthread_mutexattr_getrobust() and Operations on this mutex will still return EOWNERDEAD. Pthread_mutex_consistent(3), further pthread_mutex_lock(3) If the next owner terminates before calling Operation on such a mutex is pthread_mutex_destroy(3). Mutex will be permanently unusable and any subsequentĪttempts to lock it using pthread_mutex_lock(3) will fail Pthread_mutex_unlock(3) before making it consistent, the If the next owner unlocks the mutex using The acquired mutex to make it consistent again before The next owner should call pthread_mutex_consistent(3) on The original owner no longer exists and the mutex is in an Mutex will succeed and return EOWNERDEAD to indicate that If a mutex is initialized with the PTHREAD_MUTEX_ROBUSTĪttribute and its owner dies without unlocking it, anyįuture attempts to call pthread_mutex_lock(3) on this Mutex remains locked afterwards and any future attempts toĬall pthread_mutex_lock(3) on the mutex will block If a mutex is initialized with the PTHREAD_MUTEX_STALLEDĪttribute and its owner dies without unlocking it, the This is the default value for a mutex attributes object. Theįollowing values are valid for robustness: The owning thread dies without unlocking the mutex. The robustness attribute specifies the behavior of the mutex when The pthread_mutexattr_setrobust()įunction sets the value of the robustness attribute of the mutexĪttributes object referred to by attr to the value specified in The robustness attribute of the mutex attributes object referred The pthread_mutexattr_getrobust() function places the value of Pthread_mutexattr_getrobust(), pthread_mutexattr_setrobust(): SYNOPSIS top #include int pthread_mutexattr_getrobust(const pthread_mutexattr_t * attr, int * robustness ) int pthread_mutexattr_setrobust(pthread_mutexattr_t * attr, int robustness ) įeature Test Macro Requirements for glibc (see Pthread_mutexattr_getrobust, pthread_mutexattr_setrobust - getĪnd set the robustness attribute of a mutex attributes object c Program( threadsinredox.PTHREAD_MUTEXATTR_SETROBUST(3)Programmer'sPManual_MUTEXATTR_SETROBUST(3) NAME top threadsinlinux First thread 0 First thread 1 First thread 2 First thread 3 First thread 4 First thread 5 First thread 6 First thread 7 First thread 8 First thread 9 Second thread 0 Second thread 1 Second thread 2 Second thread 3 Second thread 4 Second thread 5 Second thread 6 Second thread 7 Second thread 8 Second thread 9 Main function after p_thread create First Thread ret1 = 0 Second Thread ret2 = 0Īctual behavior: redox login: user Welcome to Redox OS! ion: unable to get config root: App data directories not supported user:~# gcc threadsinredox.c -o threadsinredox threadsinredox.c:8:1: error: unknown type name 'pthread_mutex_t' pthread_mutex_t lock ^~~~~~~~~~~~~~~ threadsinredox.c: In function 'main': threadsinredox.c:12:2: error: unknown type name 'pthread_t' pthread_t thread1, thread2 ^~~~~~~~~ threadsinredox.c:18:9: warning: implicit declaration of function 'pthread_create' did you mean 'pthread_atfork'? ret1 = pthread_create(&thread1, NULL, myfunc, (void *) msg1) ^~~~~~~~~~~~~~ pthread_atfork threadsinredox.c:21:2: warning: implicit declaration of function 'pthread_mutex_lock' did you mean 'pthread_atfork'? pthread_mutex_lock(&lock) ^~~~~~~~~~~~~~~~~~ pthread_atfork threadsinredox.c:23:2: warning: implicit declaration of function 'pthread_mutex_unlock' did you mean 'pthread_atfork'? pthread_mutex_unlock(&lock) ^~~~~~~~~~~~~~~~~~~~ pthread_atfork threadsinredox.c:25:2: warning: implicit declaration of function 'pthread_join' did you mean 'pthread_atfork'? pthread_join(thread1, NULL) ^~~~~~~~~~~~ pthread_atfork Reproduction: gcc threadsinredox.c -o threadsinredoxĮxpected behavior: I should get output as stated below: (Which I am getting in Linux) $.