blob: c552bd4ca90dcd8cc6ffe75f923c42b39811fa5d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
/* This file is part of the Project Athena Zephyr Notification System.
* It is one of the source files comprising zwgc, the Zephyr WindowGram
* client.
*
* Created by: Marc Horowitz <marc@athena.mit.edu>
*
* $Source$
* $Author$
* $Id$
*
* Copyright (c) 1989 by the Massachusetts Institute of Technology.
* For copying and distribution information, see the file
* "mit-copyright.h".
*/
#include <zephyr/mit-copyright.h>
#ifndef mux_MODULE
#define mux_MODULE
/*
* MAX_SOURCES - the greatest file descriptor # that can be waited on minus one
* This can not exceed FD_SETSIZE from <sys/types.h>.
*/
#define MAX_SOURCES 32
/*
* mux_end_loop_p - Setting this to true during a mux_loop causes the mux_loop
* to be exited.
*/
extern int mux_end_loop_p;
/*
* void mux_init()
* Requires: mux_init has never been called before
* Effects: Initializes the mux module. Must be called before
* any other mux call.
*/
extern void mux_init();
/*
* void mux_add_input_source(int descriptior; void (*handler)(); void *arg)
* Requires: 0<=descriptor<MAX_SOURCES, mux_init has been called
* Modifies: Removes the previous input handler if any for descriptor
* Effects: Registers handler as the input handler for file descriptor
* descriptor. When mux_loop() is running and input is
* available on descriptor, handler will be called with
* argument arg.
*/
extern void mux_add_input_source();
/*
* void mux_loop()
* Requires: mux_init has been called.
* Effects: Loops until mux_end_loop_p becomes true. (Sets
* mux_end_loop_p false to start). Whenever input is
* available on an input source which has a registered
* handler (see mux_add_input_source), that handler is
* called with its argument. It is guarenteed that if
* input is available on a source, its respective input
* handler, if any, will eventually be called. No other
* ordering guarentees are made. When some signal handler
* or input handler eventually sets mux_end_loop_p to
* true, we return.
*/
extern void mux_loop();
#endif
|