event_self_cbarg() works with event_assign() for consistency with event_new().

This commit is contained in:
Ross Lagerwall 2012-03-13 21:41:22 +02:00
parent fa931bb348
commit 09a1906a2c
2 changed files with 9 additions and 2 deletions

View File

@ -1846,6 +1846,8 @@ event_assign(struct event *ev, struct event_base *base, evutil_socket_t fd, shor
{
if (!base)
base = current_base;
if (arg == &event_self_cbarg_ptr_)
arg = ev;
event_debug_assert_not_added_(ev);

View File

@ -859,8 +859,13 @@ typedef void (*event_callback_fn)(evutil_socket_t, short, void *);
struct event *ev = event_new(base, sock, events, callback, %event_self_cbarg());
</pre>
@return a value to be passed as the callback argument to event_new().
@see event_new()
For consistency with event_new(), it is possible to pass the return value
of this function as the callback argument for event_assign() &ndash; this
achieves the same result as passing the event in directly.
@return a value to be passed as the callback argument to event_new() or
event_assign().
@see event_new(), event_assign()
*/
void *event_self_cbarg(void);