@@ -92,39 +92,6 @@ int opal_pmix_base_notify_event(int status,
9292 return OPAL_SUCCESS ;
9393}
9494
95- struct lookup_caddy_t {
96- volatile bool active ;
97- int status ;
98- opal_pmix_pdata_t * pdat ;
99- };
100-
101- /******** DATA EXCHANGE ********/
102- static void lookup_cbfunc (int status , opal_list_t * data , void * cbdata )
103- {
104- struct lookup_caddy_t * cd = (struct lookup_caddy_t * )cbdata ;
105- cd -> status = status ;
106- if (OPAL_SUCCESS == status && NULL != data ) {
107- opal_pmix_pdata_t * p = (opal_pmix_pdata_t * )opal_list_get_first (data );
108- if (NULL != p ) {
109- cd -> pdat -> proc = p -> proc ;
110- if (p -> value .type == cd -> pdat -> value .type ) {
111- if (NULL != cd -> pdat -> value .key ) {
112- free (cd -> pdat -> value .key );
113- }
114- (void )opal_value_xfer (& cd -> pdat -> value , & p -> value );
115- }
116- }
117- }
118- cd -> active = false;
119- }
120-
121- static void opcbfunc (int status , void * cbdata )
122- {
123- struct lookup_caddy_t * cd = (struct lookup_caddy_t * )cbdata ;
124- cd -> status = status ;
125- cd -> active = false;
126- }
127-
12895int opal_pmix_base_exchange (opal_value_t * indat ,
12996 opal_pmix_pdata_t * outdat ,
13097 int timeout )
@@ -133,8 +100,6 @@ int opal_pmix_base_exchange(opal_value_t *indat,
133100 opal_list_t ilist , mlist ;
134101 opal_value_t * info ;
135102 opal_pmix_pdata_t * pdat ;
136- struct lookup_caddy_t caddy ;
137- char * * keys ;
138103
139104 /* protect the incoming value */
140105 opal_dss .copy ((void * * )& info , indat , OPAL_VALUE );
@@ -148,29 +113,10 @@ int opal_pmix_base_exchange(opal_value_t *indat,
148113 opal_list_append (& ilist , & info -> super );
149114
150115 /* publish it with "session" scope */
151- if (NULL == opal_pmix .publish_nb ) {
152- rc = opal_pmix .publish (& ilist );
153- OPAL_LIST_DESTRUCT (& ilist );
154- if (OPAL_SUCCESS != rc ) {
155- return rc ;
156- }
157- } else {
158- caddy .status = -1 ;
159- caddy .active = true;
160- caddy .pdat = NULL ;
161- rc = opal_pmix .publish_nb (& ilist , opcbfunc , & caddy );
162- if (OPAL_SUCCESS != rc ) {
163- OPAL_LIST_DESTRUCT (& ilist );
164- return rc ;
165- }
166- while (caddy .active ) {
167- usleep (10 );
168- }
169- OPAL_LIST_DESTRUCT (& ilist );
170- if (OPAL_SUCCESS != caddy .status ) {
171- OPAL_ERROR_LOG (caddy .status );
172- return caddy .status ;
173- }
116+ rc = opal_pmix .publish (& ilist );
117+ OPAL_LIST_DESTRUCT (& ilist );
118+ if (OPAL_SUCCESS != rc ) {
119+ return rc ;
174120 }
175121
176122 /* lookup the other side's info - if a non-blocking form
@@ -204,43 +150,20 @@ int opal_pmix_base_exchange(opal_value_t *indat,
204150
205151 /* if a non-blocking version of lookup isn't
206152 * available, then use the blocking version */
207- if ( NULL == opal_pmix . lookup_nb ) {
208- OBJ_CONSTRUCT (& ilist , opal_list_t );
209- opal_list_append (& ilist , & pdat -> super );
210- rc = opal_pmix . lookup ( & ilist , & mlist );
211- OPAL_LIST_DESTRUCT ( & mlist );
153+ OBJ_CONSTRUCT ( & ilist , opal_list_t );
154+ opal_list_append (& ilist , & pdat -> super );
155+ rc = opal_pmix . lookup (& ilist , & mlist );
156+ OPAL_LIST_DESTRUCT ( & mlist );
157+ if ( OPAL_SUCCESS != rc ) {
212158 OPAL_LIST_DESTRUCT (& ilist );
213- if (OPAL_SUCCESS != rc ) {
214- return rc ;
215- }
216- } else {
217- caddy .status = -1 ;
218- caddy .active = true;
219- caddy .pdat = pdat ;
220- keys = NULL ;
221- opal_argv_append_nosize (& keys , pdat -> value .key );
222- rc = opal_pmix .lookup_nb (keys , & mlist , lookup_cbfunc , & caddy );
223- if (OPAL_SUCCESS != rc ) {
224- OPAL_LIST_DESTRUCT (& mlist );
225- opal_argv_free (keys );
226- return rc ;
227- }
228- while (caddy .active ) {
229- usleep (10 );
230- }
231- opal_argv_free (keys );
232- OPAL_LIST_DESTRUCT (& mlist );
233- if (OPAL_SUCCESS != caddy .status ) {
234- OPAL_ERROR_LOG (caddy .status );
235- return caddy .status ;
236- }
159+ return rc ;
237160 }
238161
239162 /* pass back the result */
240163 outdat -> proc = pdat -> proc ;
241164 free (outdat -> value .key );
242165 rc = opal_value_xfer (& outdat -> value , & pdat -> value );
243- OBJ_RELEASE ( pdat );
166+ OPAL_LIST_DESTRUCT ( & ilist );
244167 return rc ;
245168}
246169
0 commit comments