00001 /* 00002 * This file is part of openMask © INRIA, CNRS, Universite de Rennes 1 1993-2002, thereinafter the Software 00003 * 00004 * The Software has been developped within the Siames Project. 00005 * INRIA, the University of Rennes 1 and CNRS jointly hold intellectual property rights 00006 * 00007 * The Software has been registered with the Agence pour la Protection des 00008 * Programmes (APP) under registration number IDDN.FR.001.510008.00.S.P.2001.000.41200 00009 * 00010 * This file may be distributed under the terms of the Q Public License 00011 * version 1.0 as defined by Trolltech AS of Norway and appearing in the file 00012 * LICENSE.QPL included in the packaging of this file. 00013 * 00014 * Licensees holding valid specific licenses issued by INRIA, CNRS or Université de Rennes 1 00015 * for the software may use this file in accordance with that specific license 00016 * 00017 */ 00018 #ifdef _SGI 00019 #include <PsnSprocSemaphore.h> 00020 #include <stdlib.h> //pour exit 00021 #include <iostream> 00022 00023 PsnSprocSemaphore::PsnSprocSemaphore(const int valeurInitiale) : PsnSemaphore(valeurInitiale) { 00024 if(sem_init(&_semaphore,0, valeurInitiale)) { 00025 perror("PsnSprocSemaphore : constructeur : impossible de creer le semaphore"); 00026 exit(0); 00027 } 00028 } 00029 00030 PsnSprocSemaphore::~PsnSprocSemaphore() { 00031 sem_destroy(&_semaphore); 00032 } 00033 00034 int PsnSprocSemaphore::V() { 00035 int ret; 00036 #ifdef _DEBUG 00037 cout <<"V "<<endl; 00038 #endif 00039 ret=sem_post(&_semaphore); 00040 if(ret) { 00041 perror("PsnSprocSemaphore : v() a échoué"); 00042 exit(0); 00043 } 00044 return(ret); 00045 } 00046 00047 int PsnSprocSemaphore::P() { 00048 int ret; 00049 #ifdef _DEBUG 00050 cout <<"P "; 00051 #endif 00052 ret=sem_wait(&_semaphore); 00053 if(ret) { 00054 perror("PsnSprocSemaphore : P a echoue"); 00055 } 00056 #ifdef _DEBUG 00057 cout<<ret<<";"<<endl; 00058 #endif 00059 return (ret); 00060 } 00061 00062 #endif
| Documentation generated on Mon Nov 25 15:25:01 2002 |
Generated with doxygen 1.2.12 by Dimitri van Heesch , 1997-2001 |