]> git.proxmox.com Git - mirror_ovs.git/blame - lib/poll-loop.h
poll-loop: Drop unused poll_fd_callback() feature.
[mirror_ovs.git] / lib / poll-loop.h
CommitLineData
064af421 1/*
d474bd01 2 * Copyright (c) 2008, 2009 Nicira Networks.
064af421 3 *
a14bc59f
BP
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
064af421 7 *
a14bc59f
BP
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
064af421
BP
15 */
16
17/* High-level wrapper around the "poll" system call.
18 *
19 * Intended usage is for the program's main loop to go about its business
20 * servicing whatever events it needs to. Then, when it runs out of immediate
21 * tasks, it calls each subordinate module's "wait" function, which in turn
22 * calls one (or more) of the functions poll_fd_wait(), poll_immediate_wake(),
23 * and poll_timer_wait() to register to be awakened when the appropriate event
24 * occurs. Then the main loop calls poll_block(), which blocks until one of
25 * the registered events happens.
26 *
27 * There is also some support for autonomous subroutines that are executed by
28 * poll_block() when a file descriptor becomes ready. To prevent these
29 * routines from starving if events are continuously ready, the application
30 * should bound the amount of work it does between poll_block() calls. */
31
32#ifndef POLL_LOOP_H
33#define POLL_LOOP_H 1
34
35#include <poll.h>
36
37struct poll_waiter;
38
39/* Schedule events to wake up the following poll_block(). */
40struct poll_waiter *poll_fd_wait(int fd, short int events);
41void poll_timer_wait(int msec);
42void poll_immediate_wake(void);
43
44/* Wait until an event occurs. */
45void poll_block(void);
46
064af421
BP
47/* Cancel a file descriptor callback or event. */
48void poll_cancel(struct poll_waiter *);
49
50#endif /* poll-loop.h */