Commit | Line | Data |
---|---|---|
805e021f CE |
1 | /* |
2 | * Copyright 2000, International Business Machines Corporation and others. | |
3 | * All Rights Reserved. | |
4 | * | |
5 | * This software has been released under the terms of the IBM Public | |
6 | * License. For details, see the LICENSE file in the top-level source | |
7 | * directory or online at http://www.openafs.org/dl/license10.html | |
8 | */ | |
9 | ||
10 | #ifndef _RX_MULTI_ | |
11 | #define _RX_MULTI_ | |
12 | ||
13 | struct multi_handle { | |
14 | int nConns; | |
15 | struct rx_call **calls; | |
16 | short *ready; | |
17 | short nReady; /* XXX UNALIGNED */ | |
18 | short *nextReady; | |
19 | short *firstNotReady; | |
20 | #ifdef RX_ENABLE_LOCKS | |
21 | afs_kmutex_t lock; | |
22 | afs_kcondvar_t cv; | |
23 | #endif /* RX_ENABLE_LOCKS */ | |
24 | }; | |
25 | ||
26 | #define multi_Rx(conns, nConns) \ | |
27 | do {\ | |
28 | struct multi_handle *multi_h;\ | |
29 | int multi_i;\ | |
30 | int multi_i0;\ | |
31 | afs_int32 multi_error;\ | |
32 | struct rx_call *multi_call;\ | |
33 | multi_h = multi_Init(conns, nConns);\ | |
34 | for (multi_i0 = multi_i = 0; ; multi_i = multi_i0 ) | |
35 | ||
36 | #define multi_Body(startProc, endProc)\ | |
37 | if (multi_h->nextReady == multi_h->firstNotReady && multi_i < multi_h->nConns) {\ | |
38 | multi_call = multi_h->calls[multi_i];\ | |
39 | if (multi_call) {\ | |
40 | startProc;\ | |
41 | rx_FlushWrite(multi_call);\ | |
42 | }\ | |
43 | multi_i0++; /* THIS is the loop variable!! */\ | |
44 | continue;\ | |
45 | }\ | |
46 | if ((multi_i = multi_Select(multi_h)) < 0) break;\ | |
47 | multi_call = multi_h->calls[multi_i];\ | |
48 | multi_error = rx_EndCall(multi_call, endProc);\ | |
49 | multi_h->calls[multi_i] = (struct rx_call *) 0 | |
50 | ||
51 | #define multi_Abort break | |
52 | ||
53 | #define multi_End\ | |
54 | multi_Finalize(multi_h);\ | |
55 | } while (0) | |
56 | ||
57 | /* Ignore remaining multi RPC's */ | |
58 | #define multi_End_Ignore\ | |
59 | multi_Finalize_Ignore(multi_h);\ | |
60 | } while (0) | |
61 | ||
62 | #endif /* _RX_MULTI_ End of rx_multi.h */ |