Android Native IPC 方案支持情况
- 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
最新文章
- Effective前端3:用CSS画一个三角形
- 用python实现的百度音乐下载器-python-pyqt-改进版
- haproxy学习之https配置
- 搭建Python+Django开发环境
- 佛洛依德 c++ 最短路径算法
- bzoj2286 消耗战
- 微信公众号开发中遇到的几个bug
- python decorator simple example
- 暴力+降复杂度 BestCoder Round #39 1002 Mutiple
- Scala Tail Recursion (尾递归)
- Mac下的SVN客户端工具Cornerstone使用教程
- js遇到这样基础题,看你能不能作对呢
- printf 缓冲区问题
- SSD和HDD的区别
- A计划(bfs)
- USB OTG简要
- [CVPR2015] Is object localization for free? – Weakly-supervised learning with convolutional neural networks论文笔记
- 分布式监控系统开发【day38】:报警自动升级代码解析及测试(八)
- JSON Web Token 入门教程
- tensorflow c/c++库使用方法
热门文章
- Testcase的编写
- HDU 4691 Front compression (2013多校9 1006题 后缀数组)
- 分享我用Taker做任务时需要的各种资源的精华帖,方便查阅
- Go语言设计模式实践:组合(Composite)
- 个人对AutoResetEvent和ManualResetEvent的理解
- windows样式(style)参考
- 提交svn的时候,提示丢失了预定增加的xxxx
- QT 5.3 VS2010 中文
- jenkins错误413 Request Entity Too Large<;
- HDU 4649 - Professor Tian(2013MUTC5-1007)(概率)