git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@790 331e1502-861f-0410-8da2-ba01fb791d7f

This commit is contained in:
atantar 2007-11-18 17:00:47 +00:00
commit adb6419766
60 changed files with 1017 additions and 1095 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,8 +46,7 @@ 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);
@ -55,48 +54,41 @@ 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);
}