compile on modern FreeBSD. After Robert Watson <rwatson@FreeBSD.org> and Alec Kloss
[arla.git] / rx / rx_multi.h
blobff73e15c59e542380f7612e9b7b1220d7c5f14af
1 /* $Id$ */
3 /*
4 ****************************************************************************
5 * Copyright IBM Corporation 1988, 1989 - All Rights Reserved *
6 * *
7 * Permission to use, copy, modify, and distribute this software and its *
8 * documentation for any purpose and without fee is hereby granted, *
9 * provided that the above copyright notice appear in all copies and *
10 * that both that copyright notice and this permission notice appear in *
11 * supporting documentation, and that the name of IBM not be used in *
12 * advertising or publicity pertaining to distribution of the software *
13 * without specific, written prior permission. *
14 * *
15 * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL *
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL IBM *
17 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY *
18 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER *
19 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *
20 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
21 ****************************************************************************
24 #ifndef _RX_MULTI_
25 #define _RX_MULTI_
27 #ifdef KERNEL
28 #include "../rx/rx.h"
29 #else /* KERNEL */
30 #include "rx.h"
31 #endif /* KERNEL */
33 struct multi_handle {
34 int nConns;
35 struct rx_call **calls;
36 short *ready;
37 short nReady; /* XXX UNALIGNED */
38 short *nextReady;
39 short *firstNotReady;
42 void
43 multi_Finalize (struct multi_handle*);
45 struct multi_handle *
46 multi_Init (struct rx_connection **, int);
48 int
49 multi_Select (struct multi_handle *);
51 #define multi_Rx(conns, nConns) \
52 do {\
53 struct multi_handle *multi_h;\
54 int multi_i;\
55 struct rx_call *multi_call;\
56 multi_h = multi_Init(conns, nConns);\
57 for (multi_i = 0; multi_i < nConns; multi_i++)
59 #define multi_Body(startProc, endProc)\
60 multi_call = multi_h->calls[multi_i];\
61 startProc;\
62 rx_FlushWrite(multi_call);\
64 while ((multi_i = multi_Select(multi_h)) >= 0) {\
65 uint32_t multi_error;\
66 multi_call = multi_h->calls[multi_i];\
67 multi_error = rx_EndCall(multi_call, endProc);\
68 multi_h->calls[multi_i] = (struct rx_call *) 0
70 #define multi_Abort break
72 #define multi_End\
73 multi_Finalize(multi_h);\
74 } while (0)
77 #endif /* _RX_MULTI_ End of rx_multi.h */