def handler(pipe, args): return f(pipe, ffi.from_handle(args))
def on_timer_event(loop, item, arg): output_s = ffi.from_handle(arg) output_s.send('PING') return 0
def on_socket_event(loop, item, arg): # typically arg would be some class object containing state # information that would be used within this event handler. input_s = ffi.from_handle(arg) assert input_s.recv() == 'PING' return -1 # end the reactor
def handler(loop, item, arg): return f(loop, item, ffi.from_handle(arg))
def handler(loop, timer_id, arg): return f(loop, timer_id, ffi.from_handle(arg))
def handler(loop, reader, arg): return f(loop, reader, ffi.from_handle(arg))