@@ -38,6 +38,7 @@ static int s1_abort(int flag, const char msg[],
3838static  int  s1_commit (void );
3939static  int  s1_fencenb (opal_list_t  * procs , int  collect_data ,
4040                      opal_pmix_op_cbfunc_t  cbfunc , void  * cbdata );
41+ static  int  s1_fence (opal_list_t  * procs , int  collect_data );
4142static  int  s1_put (opal_pmix_scope_t  scope ,
4243                  opal_value_t  * kv );
4344static  int  s1_get (const  opal_process_name_t  * id ,
@@ -61,6 +62,7 @@ const opal_pmix_base_module_t opal_pmix_s1_module = {
6162    .abort  =  s1_abort ,
6263    .commit  =  s1_commit ,
6364    .fence_nb  =  s1_fencenb ,
65+     .fence  =  s1_fence ,
6466    .put  =  s1_put ,
6567    .get  =  s1_get ,
6668    .publish  =  s1_publish ,
@@ -527,7 +529,7 @@ static int s1_commit(void)
527529static  void  fencenb (int  sd , short  args , void  * cbdata )
528530{
529531    pmi_opcaddy_t  * op  =  (pmi_opcaddy_t * )cbdata ;
530-     int  rc ;
532+     int  rc   =   OPAL_SUCCESS ;
531533    int32_t  i ;
532534    opal_value_t  * kp , kvn ;
533535    opal_hwloc_locality_t  locality ;
@@ -617,6 +619,35 @@ static int s1_fencenb(opal_list_t *procs, int collect_data,
617619    return  OPAL_SUCCESS ;
618620}
619621
622+ #define  S1_WAIT_FOR_COMPLETION (a )               \
623+     do {                                        \
624+         while ((a)) {                           \
625+             usleep(10);                         \
626+         }                                       \
627+     } while (0)
628+ 
629+ struct  fence_result  {
630+     volatile  int  flag ;
631+     int  status ;
632+ };
633+ 
634+ static  void  fence_release (int  status , void  * cbdata )
635+ {
636+     struct  fence_result  * res  =  (struct  fence_result * )cbdata ;
637+     res -> status  =  status ;
638+     opal_atomic_wmb ();
639+     res -> flag  =  0 ;
640+ }
641+ 
642+ static  int  s1_fence (opal_list_t  * procs , int  collect_data )
643+ {
644+     struct  fence_result  result  =  { 1 , OPAL_SUCCESS  };
645+     s1_fencenb (procs , collect_data , fence_release , (void * )& result );
646+     S1_WAIT_FOR_COMPLETION (result .flag );
647+     return  result .status ;
648+ }
649+ 
650+ 
620651static  int  s1_get (const  opal_process_name_t  * id ,
621652                  const  char  * key , opal_list_t  * info ,
622653                  opal_value_t  * * kv )
0 commit comments