Last change
on this file since 348 was 238, checked in by Bayard Gildas, 6 years ago |
correction sémaphore. bloquant tout ça...
|
File size:
1.3 KB
|
Rev | Line | |
---|
[2] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[2] | 4 | // %flair:license}
|
---|
| 5 | /*!
|
---|
| 6 | * \file SharedMem_impl.h
|
---|
| 7 | * \brief Class defining a shared memory
|
---|
| 8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2014/02/10
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef SHAREDMEM_IMPL_H
|
---|
| 14 | #define SHAREDMEM_IMPL_H
|
---|
| 15 |
|
---|
| 16 | #include <string>
|
---|
| 17 |
|
---|
| 18 | #ifdef __XENO__
|
---|
| 19 | #include <native/heap.h>
|
---|
| 20 | #endif
|
---|
| 21 |
|
---|
[203] | 22 | #include <Semaphore.h>
|
---|
| 23 |
|
---|
[149] | 24 | #include <SharedMem.h>
|
---|
[2] | 25 |
|
---|
| 26 | /*! \class SharedMem_impl
|
---|
| 27 | * \brief Class defining a shared memory
|
---|
| 28 | *
|
---|
| 29 | */
|
---|
| 30 |
|
---|
[15] | 31 | class SharedMem_impl {
|
---|
| 32 | public:
|
---|
| 33 | SharedMem_impl(const flair::core::SharedMem *self, std::string name,
|
---|
[149] | 34 | size_t size, flair::core::SharedMem::Type &type);
|
---|
[15] | 35 | ~SharedMem_impl();
|
---|
[2] | 36 |
|
---|
[15] | 37 | void Write(const char *buf, size_t size);
|
---|
[203] | 38 | bool Read(char *buf, size_t size, flair::core::Time nsTimeout);
|
---|
[149] | 39 | void ReaderReady();
|
---|
[2] | 40 |
|
---|
[15] | 41 | private:
|
---|
| 42 | const flair::core::SharedMem *self;
|
---|
[149] | 43 | flair::core::SharedMem::Type type;
|
---|
[15] | 44 | size_t size;
|
---|
| 45 | char *mem_segment;
|
---|
[238] | 46 | flair::core::Semaphore *sem; //for mutex type shared memory
|
---|
| 47 | flair::core::Semaphore *sem_producer,*sem_consumer; //sem_[produc|consum]er meaning = is [produc|consum]er ready?
|
---|
[2] | 48 | #ifdef __XENO__
|
---|
[15] | 49 | RT_HEAP heap;
|
---|
| 50 | bool heap_binded;
|
---|
[2] | 51 | #else
|
---|
[15] | 52 | int fd;
|
---|
[203] | 53 | std::string shm_name;
|
---|
[2] | 54 | #endif
|
---|
| 55 | };
|
---|
| 56 |
|
---|
| 57 | #endif // SHAREDMEM_IMPL_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.