git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1201 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
6837cf133d
commit
7a57ae90ee
1 changed files with 61 additions and 74 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue