android / android/ndk

[question] Robust mutex support

Open
#1,181 7 comments 0 reactions 0 assignees View on GitHub
enhancement platform issue
Dominant language
No language data
Stars
2.3k
Forks
310
PR merge metrics
No merged PRs in 30d

Description

We have developed a cross platform foundation layer- one of the objects in there is a NamedMutex. Windows named mutex are robust by default and on Linux we set the following robust attribute -

pthread_mutexattr_setrobust(&mutexAttr, PTHREAD_MUTEX_ROBUST)

On Android we compile this out, but it means we cannot recover from an abandoned mutex on Android. Is there any planned support for this?

On another note, this requires shared memory, but we require the same block of memory for a given key. We have this working using some 3rd party library and some modifications. Is there any planned support for this natively? We understand the recommended approach is to share the fd via a binder service - at this point though we are purely developing an SDK at the native level.

Contributor guide

Open the contributing guide

Research direction

Start by locating the NamedMutex implementation and the Android-specific conditional compilation around pthread_mutexattr_setrobust. Review how shared memory keyed by a given key is currently handled, including the binder-service approach mentioned in the issue. Done means determining whether native support is planned for robust mutex recovery and keyed shared memory, then documenting the answer or scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
android
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.