From 7a57ae90ee327cd0aa5abdaca1247bac99e3f2ca Mon Sep 17 00:00:00 2001 From: atantar Date: Sun, 15 Jun 2008 16:29:06 +0000 Subject: [PATCH] git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1201 331e1502-861f-0410-8da2-ba01fb791d7f --- .../paradiseo-peo/src/peoAsyncDataTransfer.h | 135 ++++++++---------- 1 file changed, 61 insertions(+), 74 deletions(-) diff --git a/trunk/paradiseo-peo/src/peoAsyncDataTransfer.h b/trunk/paradiseo-peo/src/peoAsyncDataTransfer.h index 3d8d896fc..bba165892 100755 --- a/trunk/paradiseo-peo/src/peoAsyncDataTransfer.h +++ b/trunk/paradiseo-peo/src/peoAsyncDataTransfer.h @@ -3,7 +3,7 @@ * Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008 * (C) OPAC Team, LIFL, 2002-2008 * -* Clive Canape +* Alexandru-Adrian TANTAR * * This software is governed by the CeCILL license under French law and * abiding by the rules of distribution of free software. You can use, @@ -52,6 +52,7 @@ #include "core/peo_debug.h" + class peoAsyncDataTransfer : public Cooperative, public eoUpdater { @@ -124,18 +125,71 @@ class peoAsyncDataTransfer : public Cooperative, public eoUpdater } - void operator()(); + void operator()() + { - void pack(); - void unpack(); + sendData(); // sending data + receiveData(); // receiving data + } - void packSynchronizeReq(); + void pack() + { + lock (); + + ::pack( coop_em.front()->getKey() ); + source->packMessage(); + coop_em.pop(); + + unlock(); + } + + void unpack() + { + + lock (); + destination->unpackMessage(); + unlock(); + } + + void packSynchronizeReq(){} private: - void sendData(); - void receiveData(); + void sendData() + { + + std :: vector< Cooperative* > in, out; + topology.setNeighbors( this, in, out ); + + for ( unsigned i = 0; i < out.size(); i++ ) + { + + source->pushMessage(); + + coop_em.push( out[i] ); + send( out[i] ); + + printDebugMessage( "peoAsyncDataTransfer: sending data." ); + } + } + + void receiveData() + { + + lock (); + { + + while ( !( destination->empty() ) ) + { + + printDebugMessage( "peoAsyncDataTransfer: received data." ); + destination->popMessage(); + printDebugMessage( "peoAsyncDataTransfer: done reading data." ); + } + } + unlock(); + } private: @@ -151,71 +205,4 @@ class peoAsyncDataTransfer : public Cooperative, public eoUpdater }; -void peoAsyncDataTransfer :: pack() -{ - - lock (); - - ::pack( coop_em.front()->getKey() ); - source->packMessage(); - coop_em.pop(); - - unlock(); -} - -void peoAsyncDataTransfer :: unpack() -{ - - lock (); - destination->unpackMessage(); - unlock(); -} - -void peoAsyncDataTransfer :: packSynchronizeReq() -{ -} - -void peoAsyncDataTransfer :: sendData() -{ - - std :: vector< Cooperative* > in, out; - topology.setNeighbors( this, in, out ); - - for ( unsigned i = 0; i < out.size(); i++ ) - { - - source->pushMessage(); - - coop_em.push( out[i] ); - send( out[i] ); - - printDebugMessage( "peoAsyncDataTransfer: sending data." ); - } -} - -void peoAsyncDataTransfer :: receiveData() -{ - - lock (); - { - - while ( !( destination->empty() ) ) - { - - printDebugMessage( "peoAsyncDataTransfer: received data." ); - destination->popMessage(); - printDebugMessage( "peoAsyncDataTransfer: done reading data." ); - } - } - unlock(); -} - -void peoAsyncDataTransfer :: operator()() -{ - - sendData(); // sending data - receiveData(); // receiving data -} - - #endif