[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] How to interpret paramters to timeout callback?



On Thu, Mar 13, 2014 at 9:43 AM, Jeffrey Walton <noloader@xxxxxxxxx> wrote:
> I have a persistent timer. When its callback is invoked, I log the following:
>
> timeout_cb: socket: -1; what: BEV_EVENT_READING; arg: 0x0x7362e0
>
> Is a socket of -1 expected? If so, what is the purpose of the socket?

The standard callback of an event takes a socket, a set of events, and
an argument.  -1 indicates "no socket".  Pure timeouts have no
sockets.

> Why is BEV_EVENT_READING set? Shouldn't a timer set a
> BEV_EVENT_TIMEOUT? Can I expect a BEV_EVENT_WRITING too?

Sometimes numbers can mean more than one thing; that 1 isn't
BEV_EVENT_READING; it's EV_TIMEOUT.  When you have an event callback,
the 'what' argument is a mask of EV_*, not BEV_EVENT_*.

-- 
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.