@@ -693,28 +693,28 @@ struct CmiAddressSpaceRegionMsg
693693 CmiAddressSpaceRegion region ;
694694};
695695
696- static std ::atomic < char > CmiIsomallocSyncHandlerDone ;
696+ static std ::atomic < bool > CmiIsomallocSyncHandlerDone {} ;
697697#if CMK_SMP && !CMK_SMP_NO_COMMTHD
698698extern void CommunicationServerThread (int sleepTime );
699- static std ::atomic < char > CmiIsomallocSyncCommThreadDone ;
699+ static std ::atomic < bool > CmiIsomallocSyncCommThreadDone {} ;
700700#endif
701701
702702#if CMK_SMP && !CMK_SMP_NO_COMMTHD
703- static void CmiIsomallocSyncWaitCommThread ()
703+ static void CmiIsomallocSyncWaitCommThread (std :: atomic < bool > & done )
704704{
705705 do
706706 CommunicationServerThread (5 );
707- while (!CmiIsomallocSyncCommThreadDone .load ());
707+ while (!done .load ());
708708
709709 CommunicationServerThread (5 );
710710}
711711#endif
712712
713- static void CmiIsomallocSyncWait ()
713+ static void CmiIsomallocSyncWait (std :: atomic < bool > & done )
714714{
715715 do
716716 CsdSchedulePoll ();
717- while (!CmiIsomallocSyncHandlerDone .load ());
717+ while (!done .load ());
718718
719719 CsdSchedulePoll ();
720720}
@@ -726,7 +726,7 @@ static void CmiIsomallocSyncReductionHandler(void * data)
726726 auto region = (CmiAddressSpaceRegion * )data ;
727727 CmiAssert (region == & IsoRegion );
728728
729- CmiIsomallocSyncHandlerDone = 1 ;
729+ CmiIsomallocSyncHandlerDone = true ;
730730}
731731static void CmiIsomallocSyncBroadcastHandler (void * msg )
732732{
@@ -738,7 +738,7 @@ static void CmiIsomallocSyncBroadcastHandler(void * msg)
738738
739739 CmiFree (msg );
740740
741- CmiIsomallocSyncHandlerDone = 1 ;
741+ CmiIsomallocSyncHandlerDone = true ;
742742}
743743
744744static void CmiIsomallocInitExtent (char * * argv )
@@ -850,6 +850,13 @@ static void CmiIsomallocInitExtent(char ** argv)
850850 }
851851 else if (CmiNumNodes () > 1 )
852852 {
853+ #if CMK_SMP && !CMK_SMP_NO_COMMTHD
854+ if (CmiInCommThread ())
855+ {
856+ CmiIsomallocSyncWaitCommThread (CmiIsomallocSyncCommThreadDone );
857+ }
858+ else
859+ #endif
853860 if (CmiMyRank () == 0 )
854861 {
855862 if (CmiMyNode () == 0 )
@@ -863,7 +870,7 @@ static void CmiIsomallocInitExtent(char ** argv)
863870 CmiNodeReduceStruct (& IsoRegion , CmiAddressSpaceRegionPup , CmiAddressSpaceRegionMerge ,
864871 CmiIsomallocSyncReductionHandler , nullptr );
865872
866- CmiIsomallocSyncWait ();
873+ CmiIsomallocSyncWait (CmiIsomallocSyncHandlerDone );
867874
868875 if (CmiMyNode () == 0 )
869876 {
@@ -894,15 +901,9 @@ static void CmiIsomallocInitExtent(char ** argv)
894901 CmiIsomallocSyncCommThreadDone = 1 ;
895902#endif
896903 }
897- #if CMK_SMP && !CMK_SMP_NO_COMMTHD
898- else if (CmiInCommThread ())
899- {
900- CmiIsomallocSyncWaitCommThread ();
901- }
902- #endif
903904 else
904905 {
905- CmiIsomallocSyncWait ();
906+ CmiIsomallocSyncWait (CmiIsomallocSyncHandlerDone );
906907 }
907908
908909 CmiBarrier ();
0 commit comments