event(int fd, short ev, F& handler, int priority = DEFAULT_PRIORITY)
throw(invalid_priority)
{
- event_set(this, fd, ev, &wrapper, &handler);
+ event_set(this, fd, ev, &wrapper, reinterpret_cast< void* >(&handler));
if (priority != DEFAULT_PRIORITY
&& event_priority_set(this, priority))
throw invalid_priority();
event() {}
static void wrapper(int fd, short ev, void* h)
{
- F& handler = *static_cast< F* >(h);
+ F& handler = *reinterpret_cast< F* >(h);
handler(fd, ev);
}
timer(F& handler, int priority = DEFAULT_PRIORITY)
throw(invalid_priority)
{
- evtimer_set(this, &event< F >::wrapper, &handler);
+ evtimer_set(this, &event< F >::wrapper,
+ reinterpret_cast< void* >(&handler));
if (priority != DEFAULT_PRIORITY
&& event_priority_set(this, priority))
throw invalid_priority();
signal(int signum, F& handler, int priority = DEFAULT_PRIORITY)
throw(invalid_priority)
{
- signal_set(this, signum, &event< F >::wrapper, &handler);
+ signal_set(this, signum, &event< F >::wrapper,
+ reinterpret_cast< void* >(&handler));
if (priority != DEFAULT_PRIORITY
&& event_priority_set(this, priority))
throw invalid_priority();
template < typename F >
void add_once(int fd, short ev, F& handler)
{
- internal::event_once(fd, ev, &dispatcher::wrapper< F >, &handler, 0);
+ internal::event_once(fd, ev, &dispatcher::wrapper< F >,
+ reinterpret_cast< void* >(&handler), 0);
}
/**
template < typename F >
void add_once(int fd, short ev, F& handler, const time& to)
{
- internal::event_once(fd, ev, &dispatcher::wrapper< F >, &handler, const_cast< time* >(&to)); // XXX HACK libevent don't use const
+ internal::event_once(fd, ev, &dispatcher::wrapper< F >,
+ reinterpret_cast< void* >(&handler),
+ const_cast< time* >(&to)); // XXX HACK libevent don't use const
}
/**
template < typename F >
void add_once_timer(F& handler, const time& to)
{
- internal::event_once(-1, EV_TIMEOUT, &dispatcher::wrapper< F >, &handler, const_cast< time* >(&to)); // XXX HACK libevent don't use const
+ internal::event_once(-1, EV_TIMEOUT, &dispatcher::wrapper< F >,
+ reinterpret_cast< void* >(&handler),
+ const_cast< time* >(&to)); // XXX HACK libevent don't use const
}
/**
template < typename F >
static void wrapper(int fd, short ev, void* h)
{
- F& handler = *static_cast< F* >(h);
+ F& handler = *reinterpret_cast< F* >(h);
handler(fd, ev);
}