mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Add an event_base_loopcontinue() to tell libevent to rescan right away
This commit is contained in:
parent
c0e425abdc
commit
7d6aa5ee68
19
event.c
19
event.c
@ -1619,6 +1619,25 @@ event_base_loopbreak(struct event_base *event_base)
|
||||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
event_base_loopcontinue(struct event_base *event_base)
|
||||
{
|
||||
int r = 0;
|
||||
if (event_base == NULL)
|
||||
return (-1);
|
||||
|
||||
EVBASE_ACQUIRE_LOCK(event_base, th_base_lock);
|
||||
event_base->event_continue = 1;
|
||||
|
||||
if (EVBASE_NEED_NOTIFY(event_base)) {
|
||||
r = evthread_notify_base(event_base);
|
||||
} else {
|
||||
r = (0);
|
||||
}
|
||||
EVBASE_RELEASE_LOCK(event_base, th_base_lock);
|
||||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
event_base_got_break(struct event_base *event_base)
|
||||
{
|
||||
|
@ -754,6 +754,25 @@ int event_base_loopexit(struct event_base *, const struct timeval *);
|
||||
*/
|
||||
int event_base_loopbreak(struct event_base *);
|
||||
|
||||
/**
|
||||
Tell the active event_base_loop() to scan for new events immediately.
|
||||
|
||||
Calling this function makes the currently active event_base_loop()
|
||||
start the loop over again (scanning for new events) after the current
|
||||
event callback finishes. If the event loop is not running, this
|
||||
function has no effect.
|
||||
|
||||
event_base_loopbreak() is typically invoked from this event's callback.
|
||||
This behavior is analogous to the "continue;" statement.
|
||||
|
||||
Subsequent invocations of event loop will proceed normally.
|
||||
|
||||
@param eb the event_base structure returned by event_init()
|
||||
@return 0 if successful, or -1 if an error occurred
|
||||
@see event_base_loopbreak()
|
||||
*/
|
||||
int event_base_loopcontinue(struct event_base *);
|
||||
|
||||
/**
|
||||
Checks if the event loop was told to exit by event_loopexit().
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user