New style for PEO

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@789 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
canape 2007-11-16 11:34:20 +00:00
commit 9c87b3b0c0
132 changed files with 3781 additions and 3396 deletions

View file

@ -1,4 +1,4 @@
/*
/*
* <communicable.cpp>
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
* (C) OPAC Team, LIFL, 2002-2007
@ -46,7 +46,8 @@ static std :: map <const Communicable *, unsigned> comm_to_key; /* Map of regist
unsigned Communicable :: num_comm = 0;
Communicable :: Communicable () {
Communicable :: Communicable ()
{
comm_to_key [this] = key = ++ num_comm;
key_to_comm.push_back (this);
@ -54,41 +55,48 @@ Communicable :: Communicable () {
sem_init (& sem_stop, 0, 0);
}
Communicable :: ~ Communicable () {
Communicable :: ~ Communicable ()
{
}
COMM_ID Communicable :: getKey () {
COMM_ID Communicable :: getKey ()
{
return key;
}
Communicable * getCommunicable (COMM_ID __key) {
Communicable * getCommunicable (COMM_ID __key)
{
assert (__key < key_to_comm.size ());
return key_to_comm [__key];
return key_to_comm [__key];
}
COMM_ID getKey (const Communicable * __comm) {
COMM_ID getKey (const Communicable * __comm)
{
return comm_to_key [__comm];
}
void Communicable :: lock () {
void Communicable :: lock ()
{
sem_wait (& sem_lock);
}
sem_wait (& sem_lock);
}
void Communicable :: unlock () {
void Communicable :: unlock ()
{
sem_post (& sem_lock);
}
void Communicable :: stop () {
void Communicable :: stop ()
{
sem_wait (& sem_stop);
}
void Communicable :: resume () {
void Communicable :: resume ()
{
sem_post (& sem_stop);
}