- Binder - 不支持Native层的binder
- 内存共享 - 不支持
- 信号量(信号灯) - 不支持
- 消息队列 - 不支持
- 信号 - 支持,但是不能用sigqueue传消息,只能用来安装信号,可以用来收集Native Crash日志
- 管道 - 匿名管道,支持
- 管道 - FIFO,支持
- socket - 支持
[参考资料] 为何binder在native不受支持 https://groups.google.com/forum/?fromgroups=#!topic/android-ndk/1QmVRrNckfM
为何不支持内存共享、消息队列、信号量 ,参见https://android.googlesource.com/platform/ndk/+/4e159d95ebf23b5f72bb707b0cb1518ef96b3d03/docs/system/libc/SYSV-IPC.TXT
https://groups.google.com/forum/#!topic/android-ndk/FzJIsJIxCX4
http://stackoverflow.com/questions/18603267/cross-process-locking-with-android-ndk
Android源代码中的文档说明:http://www.netmite.com/android/mydroid/1.6/bionic/libc/docs/SYSV-IPC.TXT
(该文件在Android4。3中似乎已经移出该文档)
Android does not support System V IPCs, i.e. the facilities provided by the following standard Posix headers: <sys/sem.h> /* SysV semaphores */ <sys/shm.h> /* SysV shared memory segments */ <sys/msg.h> /* SysV message queues */ <sys/ipc.h> /* General IPC definitions */ The reason for this is due to the fact that, by design, they lead to global kernel resource leakage.
原因就是防止内核资源泄露。
另外:fork()也尽量不要用。
道理很简单:我们不应该控制android的底层,这些api会造成系统的不稳定。
https://groups.google.com/forum/#!msg/android-platform/80jr-_A-9bU/nkzslcgVrfYJ
“Bear in mind that the Dalvik VM doesn't like fork() much, and goes into conniptions if you try to do *any* work between the fork() and the exec(). ”
https://groups.google.com/forum/#!topic/android-ndk/FzJIsJIxCX4