source: flair-src/trunk/lib/FlairCore/src/unexported/Semaphore_impl.h

Last change on this file was 238, checked in by Bayard Gildas, 4 years ago

correction sémaphore. bloquant tout ça...

File size: 1.0 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5/*!
6 * \file Semaphore_impl.h
7 * \brief Class defining a semaphore implementation
8 * \author Thomas Fuhrmann, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2016/11/16
10 * \version 1.0
11 */
12
13#ifndef SEMAPHORE_IMPL_H
14#define SEMAPHORE_IMPL_H
15
16#ifdef __XENO__
17#include <native/sem.h>
18#else
19#include <fcntl.h>
20#include <semaphore.h>
21#endif
22
23namespace flair {
24namespace core {
25class Semaphore;
26class Object;
27}
28}
29
30class Semaphore_impl {
31public:
32  Semaphore_impl(flair::core::Semaphore *self, std::string name, uint32_t initialValue, flair::core::Semaphore::Type &type);
33  ~Semaphore_impl();
34  bool TryGetSemaphore();
35  bool GetSemaphore(flair::core::Time timeout = TIME_INFINITE);
36  bool ReleaseSemaphore(void);
37#ifdef __XENO__
38  RT_SEM semaphore;
39#else
40  std::string sem_name;
41  sem_t *semaphore;
42#endif
43
44private:
45  flair::core::Semaphore *self;
46  flair::core::Semaphore::Type type;
47};
48
49#endif // SEMAPHORE_IMPL_H
Note: See TracBrowser for help on using the repository browser.