ioloop.h revision 2f2c523b0870412d4631917fa166ee312508e0ec
/* Time when the I/O loop started calling handlers. Can be used instead of time(NULL). */ /* Number of microseconds spent on all the ioloops waiting for themselves. */ /* You can create different handlers for IO_READ and IO_WRITE. IO_READ and IO_ERROR can't use different handlers (and there's no point anyway). Don't try to add multiple handlers for the same type. It's not checked and the behavior will be undefined. */ /* Remove I/O handler, and set io pointer to NULL. */ /* Like io_remove(), but assume that the file descriptor is already closed. With some backends this simply frees the memory. */ /* Make sure the I/O callback is called by io_loop_run() even if there isn't any input actually pending currently as seen by the OS. This may be useful if some of the input has already read into some internal buffer and the caller wants to handle it the same way as if the fd itself had input. */ /* Remove timeout handler, and set timeout pointer to NULL. */ /* Reset timeout so it's next run after now+msecs. */ /* Refresh ioloop_time and ioloop_timeval variables. */ /* call these if you wish to run the iteration only once */ /* Specify the maximum number of fds we're expecting to use. */ /* Destroy I/O loop and set ioloop pointer to NULL. */ /* If time moves backwards or jumps forwards call the callback. */ /* Change the current_ioloop. */ /* Call the callback whenever ioloop is changed. */ /* Create a new ioloop context. This context is automatically attached to all the following I/Os and timeouts that are added until the context is deactivated (e.g. returning to back to a running ioloop). Whenever such added I/O or timeout callback is called, this context is automatically Creating this context already deactivates any currently running context and activates the newly created context. */ /* Call the activate callback when this context is activated (I/O callback is about to be called), and the deactivate callback when the context is deactivated (I/O callback has returned). You can add multiple callbacks. The ioloop context is a global state, so only a single context can be active at a time. The callbacks are guaranteed to be called only at their proper states, i.e. activate() callback is called only when switching from no context to the active context, and deactive() is called only when switching from previously activated context into no context. No context is active at a time when the ioloop is destroyed. */ /* Remove callbacks with the given callbacks and context. */ /* Returns the current context set to ioloop. */ /* Explicitly activate an ioloop context. There must not be any context active at the moment, so this most likely shouldn't be called while ioloop is running. An activated context must be explicitly deactivated with io_loop_context_deactivate() before the ioloop is destroyed, or before /* Explicitly deactivate an ioloop context. The given context must be currently active or it assert-crashes. This should be called only after a context was explicitly activated with io_loop_context_activate(). */ /* Returns fd, which contains all of the ioloop's current notifications. When it becomes readable, there is a new notification. Calling this function stops the existing notifications in the ioloop from working anymore. This function's main idea is that the fd can be passed to another process, which can use it to find out if an interesting notification happens. Returns fd on success, -1 on error. */ /* IO wait timers can be used to track how much time the io_wait_timer has spent on waiting in its ioloops. This is similar to io_loop_get_wait_usecs(), but it's easier to use when the wait time needs to be tracked across multiple ioloops. */ /* Move the given I/O into the provided/current I/O loop if it's not already there. New I/O is returned, while the old one is freed. */ /* Like io_loop_move_io(), but for timeouts. */ /* Returns TRUE if any IOs have been added to the ioloop. */ /* Returns TRUE if there is a pending timeout that is going to be run /* Returns number of microseconds spent on the ioloop waiting itself. */ /* Return all io conditions added for the given fd. This needs to scan through all the file ios in the ioloop. */