OpenAFS
OpenAFS distributed network file system
/cygdrive/c/src/openafs/openafs.git/repo/src/rx/rx_multi.h
00001 /*
00002  * Copyright 2000, International Business Machines Corporation and others.
00003  * All Rights Reserved.
00004  *
00005  * This software has been released under the terms of the IBM Public
00006  * License.  For details, see the LICENSE file in the top-level source
00007  * directory or online at http://www.openafs.org/dl/license10.html
00008  */
00009 
00010 #ifndef _RX_MULTI_
00011 #define _RX_MULTI_
00012 
00013 struct multi_handle {
00014     int nConns;
00015     struct rx_call **calls;
00016     short *ready;
00017     short nReady;               /* XXX UNALIGNED */
00018     short *nextReady;
00019     short *firstNotReady;
00020 #ifdef RX_ENABLE_LOCKS
00021     afs_kmutex_t lock;
00022     afs_kcondvar_t cv;
00023 #endif                          /* RX_ENABLE_LOCKS */
00024 };
00025 
00026 #define multi_Rx(conns, nConns) \
00027     do {\
00028         struct multi_handle *multi_h;\
00029         int multi_i;\
00030         int multi_i0;\
00031         afs_int32 multi_error;\
00032         struct rx_call *multi_call;\
00033         multi_h = multi_Init(conns, nConns);\
00034         for (multi_i0 = multi_i = 0; ; multi_i = multi_i0 )
00035 
00036 #define multi_Body(startProc, endProc)\
00037         if (multi_h->nextReady == multi_h->firstNotReady && multi_i < multi_h->nConns) {\
00038             multi_call = multi_h->calls[multi_i];\
00039             if (multi_call) {\
00040                 startProc;\
00041                 rx_FlushWrite(multi_call);\
00042             }\
00043             multi_i0++;  /* THIS is the loop variable!! */\
00044             continue;\
00045         }\
00046         if ((multi_i = multi_Select(multi_h)) < 0) break;\
00047         multi_call = multi_h->calls[multi_i];\
00048         multi_error = rx_EndCall(multi_call, endProc);\
00049         multi_h->calls[multi_i] = (struct rx_call *) 0
00050 
00051 #define multi_Abort break
00052 
00053 #define multi_End\
00054         multi_Finalize(multi_h);\
00055     } while (0)
00056 
00057 /* Ignore remaining multi RPC's */
00058 #define multi_End_Ignore\
00059         multi_Finalize_Ignore(multi_h);\
00060     } while (0)
00061 
00062 #endif /* _RX_MULTI_     End of rx_multi.h */
 All Data Structures Files Functions Variables