From a6612f36646eaea0152a504c6eab1a50f7eaedaf Mon Sep 17 00:00:00 2001 From: Rich Graham Date: Sat, 10 Jan 2004 23:12:43 +0000 Subject: [PATCH] Add array to hold communicator pointers, and inline accessor method. This commit was SVN r233. --- src/mpi/communicator/communicator.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/mpi/communicator/communicator.h b/src/mpi/communicator/communicator.h index e7c28db2b5..748b93ff0e 100644 --- a/src/mpi/communicator/communicator.h +++ b/src/mpi/communicator/communicator.h @@ -41,4 +41,19 @@ struct lam_communicator_t { }; typedef struct lam_communicator_t lam_communicator_t; + +/* return pointer to communicator associated with context id cid, + * No error checking is done*/ +static inline lam_communicator_t *get_comm_ptr(uint32_t cid) +{ + /* array of pointers to communicators, indexed by context ID */ + extern lam_communicator_t **lam_cummunicator_ptrs; + extern uint32_t len_lam_cummunicator_ptrs; +#ifdef LAM_ENABLE_DEBUG + if(cid >= len_lam_cummunicator_ptrs) + return (lam_communicator_t *) NULL; +#endif + return lam_cummunicator_ptrs[cid]; +} + #endif /* LAM_COMMUNICATOR_H */