开发者

application-driven events in libevent

I'd like to use libevent to prototype an event-driven application. Specifically, I want to use the开发者_开发技巧 PHP libevent extension.

What I'm wondering is the following. libevent seems to revolve around open file handler/socket/streams events. I'd like to be able to throw my own application-driven events for communication.

So, how would one use a file handle to pass around custom events? Is this really the way to go?


The solution for this is as follows..

There's no need to deal with non io-based events in this manner, as they will never have to end up in the event loop.

The rule is pretty much, "all io-based events are added to the loop, all other events are executed immediately".

This does leave me with the issue of having to 'fake' events, or simply have slightly deferred execution. libevent does provide timed events, and there is a PHP api for this but it's undocumented and I couldn't get it to work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜