Rev | Line | |
---|
[42] | 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.h
|
---|
| 7 | * \brief Class defining a semaphore
|
---|
| 8 | * \author Thomas Fuhrmann, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2016/11/16
|
---|
| 10 | * \version 1.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef SEMAPHORE_H
|
---|
| 14 | #define SEMAPHORE_H
|
---|
| 15 |
|
---|
| 16 | #include <Object.h>
|
---|
| 17 |
|
---|
| 18 | class Semaphore_impl;
|
---|
| 19 | class ConditionVariable_impl;
|
---|
| 20 |
|
---|
| 21 | namespace flair {
|
---|
| 22 | namespace core {
|
---|
| 23 |
|
---|
| 24 | /*! \class Semaphore
|
---|
| 25 | *
|
---|
| 26 | * \brief Class defining a semaphore
|
---|
| 27 | *
|
---|
| 28 | */
|
---|
| 29 | class Semaphore : public Object {
|
---|
| 30 | friend class ::ConditionVariable_impl;
|
---|
| 31 |
|
---|
| 32 | public:
|
---|
| 33 | /*!
|
---|
| 34 | * \brief Constructor
|
---|
| 35 | *
|
---|
| 36 | * Construct a semaphore.
|
---|
| 37 | *
|
---|
| 38 | * \param parent parent
|
---|
| 39 | * \param name name
|
---|
| 40 | */
|
---|
| 41 | Semaphore(const Object *parent, uint32_t initialValue, std::string name = "");
|
---|
| 42 |
|
---|
| 43 | /*!
|
---|
| 44 | * \brief Destructor
|
---|
| 45 | *
|
---|
| 46 | */
|
---|
| 47 | ~Semaphore();
|
---|
| 48 |
|
---|
| 49 | /*!
|
---|
| 50 | * \brief GetSemaphore
|
---|
| 51 | *
|
---|
| 52 | * Lock the semaphore.
|
---|
[47] | 53 | *
|
---|
| 54 | * \param timeout The timeout, in nanoseconds.
|
---|
[42] | 55 | */
|
---|
[47] | 56 | bool GetSemaphore(Time timeout = TIME_INFINITE) const;
|
---|
[42] | 57 |
|
---|
| 58 | /*!
|
---|
| 59 | * \brief ReleaseSemaphore
|
---|
| 60 | *
|
---|
| 61 | * Unlock the semaphore.
|
---|
| 62 | *
|
---|
| 63 | */
|
---|
[47] | 64 | bool ReleaseSemaphore(void) const;
|
---|
[42] | 65 |
|
---|
| 66 | private:
|
---|
| 67 | class Semaphore_impl *pimpl_;
|
---|
| 68 | };
|
---|
| 69 |
|
---|
| 70 | } // end namespace core
|
---|
| 71 | } // end namespace flair
|
---|
| 72 |
|
---|
| 73 | #endif // SEMAPHORE_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.