Sunanda Sharma
Sunanda Sharma

Reputation: 53

Robust pthread mutexes - portability across platforms

I want to use shared memory across processes and wanted to use the robust pthread mutexes for the same, because, they can help with the problem when a process dies holding the mutex. My only concern is, are they portable across different platforms - different versions of linux and then on different operating systems too? The earlier versions of pthread.h have just the _NP versions ofPTHREAD_MUTEX_ROBUST attribute. I could not find much documentation about the portability online.

Would really appreciate any repsonse on the same.

Upvotes: 1

Views: 806

Answers (1)

Pavan Manjunath
Pavan Manjunath

Reputation: 28545

POSIX mandates pthread_mutexattr_getrobust. And hence all POSIX compliant systems should support it. Also note that pthread_mutexattr_getrobust was first introduced in Issue 7. ie POSIX:2008 Do check this on the systems where you want to port.

On the latest linux variants, I think you should be safe.

Upvotes: 2

Related Questions