前几天我正好也遇到这样一个需求,感觉每次read 1byte的系统调用overhead太大了,于是在StackOverflow上问了这个问题,得到了一个相当详尽的解答,结论是有办法控制阻塞模式下串口一次read的最小数据量。答者还指出使用select()或poll()+非阻塞模式是非常不可取的方法:
If your program uses non-blocking mode but does not perform useful work while waiting for data, and instead uses select() or poll() (or even worse calls sleep()), then your program is unnecessarily complex and ineffecient.
不想读大段的英文也没关系,我正准备写一篇文章来分享自己读完那个答案之后的心得
If your program uses non-blocking mode but does not perform useful work while waiting for data, and instead uses select() or poll() (or even worse calls sleep()), then your program is unnecessarily complex and ineffecient.
不想读大段的英文也没关系,我正准备写一篇文章来分享自己读完那个答案之后的心得
]]>谢谢晕哥指导:-)
]]>https://blog.csdn.net/zhuxiaoping54532/article/details/51701549
]]>用阻塞+线程没有问题
OK 谢谢指导
]]>