Remove evperiodic_assign and its related parts: its functionality is subsumed by EV_PERSIST timeouts.

svn:r1040
This commit is contained in:
Nick Mathewson 2009-01-22 17:56:15 +00:00
parent 5e6f6dcd1b
commit f20902a290
4 changed files with 0 additions and 65 deletions

19
event.c
View File

@ -145,7 +145,6 @@ static void timeout_process(struct event_base *);
static void timeout_correct(struct event_base *, struct timeval *); static void timeout_correct(struct event_base *, struct timeval *);
static void event_signal_closure(struct event_base *, struct event *ev); static void event_signal_closure(struct event_base *, struct event *ev);
static void event_periodic_closure(struct event_base *, struct event *ev);
static void event_persist_closure(struct event_base *, struct event *ev); static void event_persist_closure(struct event_base *, struct event *ev);
static int evthread_notify_base(struct event_base *base); static int evthread_notify_base(struct event_base *base);
@ -566,13 +565,6 @@ event_haveevents(struct event_base *base)
return (base->event_count > 0); return (base->event_count > 0);
} }
static void
event_periodic_closure(struct event_base *base, struct event *ev)
{
event_add(ev, &ev->_ev.ev_periodic.tv_interval);
(*ev->ev_callback)((int)ev->ev_fd, ev->ev_res, ev->ev_arg);
}
static void static void
event_persist_closure(struct event_base *base, struct event *ev) event_persist_closure(struct event_base *base, struct event *ev)
{ {
@ -950,17 +942,6 @@ event_assign(struct event *ev, struct event_base *base, evutil_socket_t fd, shor
assert(event_base_set(base, ev) == 0); assert(event_base_set(base, ev) == 0);
} }
void
evperiodic_assign(struct event *ev, struct event_base *base,
const struct timeval *tv,
void (*cb)(evutil_socket_t, short, void *), void *arg)
{
event_assign(ev, base, -1, EV_TIMEOUT, cb, arg);
ev->_ev.ev_periodic.tv_interval = *tv;
ev->ev_closure = event_periodic_closure;
}
struct event * struct event *
event_new(struct event_base *base, evutil_socket_t fd, short events, void (*cb)(evutil_socket_t, short, void *), void *arg) event_new(struct event_base *base, evutil_socket_t fd, short events, void (*cb)(evutil_socket_t, short, void *), void *arg)
{ {

View File

@ -284,22 +284,6 @@ int event_base_loopexit(struct event_base *, const struct timeval *);
*/ */
int event_base_loopbreak(struct event_base *); int event_base_loopbreak(struct event_base *);
/**
Define a periodic timer.
Behaves like a timer only that it repeats at the specified interval.
To start this time, it needs to be added via event_add().
@param ev event struct to be modified
@param base the event base to which this event belongs
@param tv periodicity interval
@param cb callback function
@param arg argument that will be passed to the callback function
*/
void evperiodic_assign(struct event *ev, struct event_base *base,
const struct timeval *tv, void (*cb)(int, short, void *), void *arg);
/* Flags to pass to event_set(), event_new(), event_assign(), /* Flags to pass to event_set(), event_new(), event_assign(),
* event_pending(), and anything else with an argument of the form * event_pending(), and anything else with an argument of the form
* "short events" */ * "short events" */

View File

@ -98,10 +98,6 @@ struct event {
/* Allows deletes in callback */ /* Allows deletes in callback */
short *ev_pncalls; short *ev_pncalls;
} ev_signal; } ev_signal;
struct {
struct timeval tv_interval;
} ev_periodic;
} _ev; } _ev;
short ev_events; short ev_events;

View File

@ -482,31 +482,6 @@ periodic_timeout_cb(int fd, short event, void *arg)
} }
} }
static void
test_periodictimeout(void)
{
struct timeval tv, tv_interval;
struct event ev;
int count = 0;
setup_test("Periodic timeout: ");
timerclear(&tv_interval);
tv_interval.tv_usec = 10000;
tv.tv_usec = 0;
tv.tv_sec = 0;
evperiodic_assign(&ev, global_base, &tv_interval,
periodic_timeout_cb, &count);
event_add(&ev, &tv);
event_dispatch();
event_del(&ev);
cleanup_test();
}
static void static void
test_persistent_timeout(void) test_persistent_timeout(void)
{ {
@ -2378,7 +2353,6 @@ main (int argc, char **argv)
test_evutil_snprintf(); test_evutil_snprintf();
util_suite(); util_suite();
test_periodictimeout();
test_persistent_timeout(); test_persistent_timeout();
/* use the global event base and need to be called first */ /* use the global event base and need to be called first */