我正在使用 libubox 做一个项目。我已经指出 libubox 在顺序模式下而不是在多线程模式下执行函数。
有没有人可以证实这一点?
最佳答案
不,libubox不支持多线程
在 Felix(Libubox 开发者)的辩护之后
On 2012-11-07 2:59 PM, KALLEL Mohamed wrote:
Hello
I m contributing in the development of an opensource project which use libubox. and I remarked that libubox execute handler functions in monothread mode and not in muItithread mode.
1) so I m wondering if the libubox supports execution of handler in multi thread mode ?
2) if yes how to activate multithread for registred handlers with libubox
3) if no. I m able to create 2 threads in my main program and then each thread will call libubox functions to register handler function. Could you give a quick how to do it with libubox? Hi,
libubox 中的 uloop 目前并不是以线程安全的方式设计的。我 建议只在一个线程中运行 uloop,然后处理 处理接收到的事件关闭到其他线程。那会是 足以满足您的应用程序的需求,或者您需要任何特定的 变化?
我还没有真正研究过 epoll 的线程安全使用(这是 内部在uloop中使用),只记得最近的一些kernel相关的 讨论指出它的线程使用可能有点棘手 因为最近才修复了一些竞争条件。
- 菲利克斯
关于c - libubox是否支持多线程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13265678/