Pyjo.Reactor.Poll - Low-level event reactor with poll support

import Pyjo.Reactor.Poll

# Watch if handle becomes readable or writable
reactor = Pyjo.Reactor.Poll.new()

def io_cb(reactor, writable):
    if writable:
        print('Handle is writable')
    else:
        print('Handle is readable')

reactor.io(io_cb, handle)

# Change to watching only if handle becomes writable
reactor.watch(handle, read=False, write=True)

# Add a timer
def timer_cb(reactor):
    reactor.remove(handle)
    print('Timeout!')

reactor.timer(timer_cb, 15)

# Start reactor if necessary
if not reactor.is_running:
    reactor.start()

Pyjo.Reactor.Poll is a low-level event reactor based on select.poll().

Events

Pyjo.Reactor.Poll inherits all events from Pyjo.Reactor.Select.

Classes

class Pyjo.Reactor.Poll.Pyjo_Reactor_Poll(**kwargs)

Pyjo.Reactor.Poll inherits all attributes and methods from Pyjo.Reactor.Select and implements the following new ones.

one_tick()
reactor.one_tick()

Run reactor until an event occurs. Note that this method can recurse back into the reactor, so you need to be careful. Meant to be overloaded in a subclass.

remove(remove)
boolean = reactor.remove(handle)
boolean = reactor.remove(tid)

Remove handle or timer.

reset()
reactor.reset()

Remove all handles and timers.

watch(handle, read, write)
reactor = reactor.watch(handle, read, write)

Change I/O events to watch handle for with true and false values. Meant to be overloaded in a subclass. Note that this method requires an active I/O watcher.

Pyjo.Reactor.Poll.object

alias of Pyjo_Reactor_Poll