On Tue, Nov 6, 2012 at 7:37 AM, Nick Mathewson <nickm@xxxxxxxxxxxxx> wrote:
Right now the best way to do what you have in mind is to consider *why* you only want to read partial data and then read again after the next event loop -- there's usually a better way to do whatever you're trying to achieve.
The main reason for doing this is to avoid spending unfair amount of time on a single stream.
But if there isn't, and you want to make sure your code works with future versions of Libevent, your best bet is either to add a feature like this in Libevent 2.1, or to create a separate event whose callback will also run the bufferevent's callback, and activate that one.Is it true that the event_active() works only from a different thread? I see event_active() eventually calls event_callback_activate_nolock_() & it checks if the thread_id is different. So event if I create a separate event & call event_active() on that event, from the same thread, would it still work?
int
event_callback_activate_nolock_(struct event_base *base,
struct event_callback *evcb)
{
...
event_queue_insert_active(base, evcb);
if (EVBASE_NEED_NOTIFY(base)) <-----
evthread_notify_base(base);