From 540ec56e1dd982c717716e576df78024b0f54f2e Mon Sep 17 00:00:00 2001 From: atantar Date: Fri, 30 Nov 2007 09:42:52 +0000 Subject: [PATCH] git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@827 331e1502-861f-0410-8da2-ba01fb791d7f --- trunk/paradiseo-peo/src/peoSyncIslandMig.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/trunk/paradiseo-peo/src/peoSyncIslandMig.h b/trunk/paradiseo-peo/src/peoSyncIslandMig.h index 149c28bf8..f161fc1c9 100644 --- a/trunk/paradiseo-peo/src/peoSyncIslandMig.h +++ b/trunk/paradiseo-peo/src/peoSyncIslandMig.h @@ -223,6 +223,7 @@ private: bool standbyMigration; std :: vector< Cooperative* > in, out, all; + unsigned nbMigrations; }; @@ -281,10 +282,14 @@ template< class EOT > void peoSyncIslandMig< EOT > :: emigrate() template< class EOT > void peoSyncIslandMig< EOT > :: immigrate() { - assert( imm.size() ); + assert( imm.size() ); + + while ( imm.size() ) { replace( destination, imm.front() ) ; imm.pop(); - printDebugMessage( "peoSyncIslandMig: receiving some immigrants." ); + } + + printDebugMessage( "peoSyncIslandMig: receiving some immigrants." ); } template< class EOT > void peoSyncIslandMig< EOT > :: operator()() @@ -294,6 +299,7 @@ template< class EOT > void peoSyncIslandMig< EOT > :: operator()() { explicitPassive = standbyMigration = false; topology.setNeighbors( this, in, out ); all = topology; + nbMigrations = 0; synchronizeCoopEx(); stop(); @@ -315,8 +321,13 @@ template< class EOT > void peoSyncIslandMig< EOT > :: notifySending() template< class EOT > void peoSyncIslandMig< EOT > :: notifyReceiving() { - if ( standbyMigration ) getOwner()->setActive(); - sem_post( &sync ); + nbMigrations++; + + if ( nbMigrations == in.size() ) { + + if ( standbyMigration ) getOwner()->setActive(); + sem_post( &sync ); + } } template< class EOT > void peoSyncIslandMig< EOT > :: notifySendingSyncReq () {