Android 是否支持进程共享的互斥锁和条件变量?我听说仿生实现不支持它们,因为 Android 有其他 IPC 方式,但找不到可以确认或否认它的信息。
消息来源有点混乱。在 pthread_mutexattr_setpshared 之前的仿生 pthread_mutex.cpp中有一条评论:
/* process-shared mutexes are not supported at the moment */
但在函数内部还写着:
/* our current implementation of pthread actually supports shared
* mutexes but won't cleanup if a process dies with the mutex held.
* Nevertheless, it's better than nothing. Shared mutexes are used
* by surfaceflinger and audioflinger.
*/
那么有没有人在原生安卓应用程序中使用过进程共享的互斥锁(和条件变量)(例如,通过与ashmem_create_region共享它们)?