Expose EVLOOP_NONBLOCK
authorYunqi Zhang <yunqifb@fb.com>
Thu, 19 Jun 2014 01:40:19 +0000 (18:40 -0700)
committerAnton Likhtarov <alikhtarov@fb.com>
Thu, 26 Jun 2014 02:25:59 +0000 (19:25 -0700)
commit51e98fa77aceb9e5bba5cff4907c1b315d40d8db
treeea95f92f73a69162dee86027fcfb080774a6e64a
parenta97b3be50704647a2df0b36f54ad17b1e7151d31
Expose EVLOOP_NONBLOCK

Summary:
This diff allows users to loop through EventBase without blocking if there are
not any events to process.

This is useful for sending and receiving requests on network, where users just
want to try if there are any events and do not want to block if not.

https://phabricator.fb.com/D1373887 is an example where we find this feature
useful, otherwise we have to add an empty callback before loop.
event_base_.runInLoop([] {});
event_base_.loopOnce();

@davejwatson, @fugalh, @simpkins, @stepan: Could you please take a look at the
proposed changes and let me know if there is any better ways of doing this.

Thank you!

Test Plan:
I think this would not break anything, but we might want to do some performance
profiling if needed.

Reviewed By: hans@fb.com

Subscribers: simpkins, davejwatson, fugalh, stepan, folly@lists

FB internal diff: D1383401
folly/io/async/EventBase.cpp
folly/io/async/EventBase.h