Function ReactorFD.registerCallback

Register a user callback to be called if the FD is "active"

void registerCallback (
  mecca.reactor.subsystems.poller.Direction dir,
  void delegate(void*) dlg,
  void* opaq,
  bool oneShot = true
) nothrow @nogc @safe;

Warning: Using this function without understanding the underlying mechanism might cause the callback to not get called. Use with caution!

Registers a callback to be called the next time an event is available on the file descriptor. The semantics of when the callback will be called follow the same rules as epoll's edge trigger mode. This means that if the last operation performed with the FD did not block, the callback will not be called.

One way to make sure this doesn't happen is to call a blocking function with a timeout of zero.

Use unregisterCallback to unregister the callback.

Parameters

NameDescription
dir direction (Read/Write) to register. The Direction.Both is illegal here.
dlg the delegate to be called
opaq a value that will be passed, as is, to the delegate.
oneShot if set to true, the callback will automatically be deregistered after being called once.