Last change
on this file since 279 was 213, checked in by Sanahuja Guillaume, 7 years ago |
thread stack size rework
add Matrix class
|
File size:
1.7 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 Thread_impl.h
|
---|
| 7 | * \brief Classe définissant un thread
|
---|
| 8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 9 | * \date 2012/10/04
|
---|
| 10 | * \version 4.0
|
---|
| 11 | */
|
---|
| 12 | #ifndef THREAD_IMPL_H
|
---|
| 13 | #define THREAD_IMPL_H
|
---|
| 14 |
|
---|
| 15 | #include <string>
|
---|
| 16 | #include <stdint.h>
|
---|
| 17 | #include <Object.h>
|
---|
| 18 | #ifdef __XENO__
|
---|
| 19 | #include <native/task.h>
|
---|
| 20 | #else
|
---|
| 21 | #include <pthread.h>
|
---|
| 22 | #endif
|
---|
| 23 |
|
---|
[15] | 24 | namespace flair {
|
---|
| 25 | namespace core {
|
---|
| 26 | class Thread;
|
---|
| 27 | class IODevice;
|
---|
| 28 | class ConditionVariable;
|
---|
[2] | 29 | }
|
---|
[15] | 30 | }
|
---|
[2] | 31 |
|
---|
[15] | 32 | class Thread_impl {
|
---|
| 33 | public:
|
---|
[213] | 34 | Thread_impl(flair::core::Thread *self, uint8_t priority,uint32_t stackSize);
|
---|
[15] | 35 | ~Thread_impl();
|
---|
| 36 | void Start(void);
|
---|
| 37 | void Join(void);
|
---|
| 38 | void SafeStop(void);
|
---|
| 39 | bool ToBeStopped(void);
|
---|
| 40 | void SetPeriodUS(uint32_t period);
|
---|
| 41 | uint32_t GetPeriodUS(void) const;
|
---|
| 42 | void SetPeriodMS(uint32_t period);
|
---|
| 43 | uint32_t GetPeriodMS(void) const;
|
---|
| 44 | void WaitPeriod(void);
|
---|
| 45 | void Suspend(void);
|
---|
| 46 | bool SuspendUntil(flair::core::Time date);
|
---|
| 47 | void Resume(void);
|
---|
| 48 | bool IsSuspended(void);
|
---|
| 49 | int WaitUpdate(const flair::core::IODevice *device);
|
---|
| 50 | bool period_set;
|
---|
[139] | 51 | bool isRunning;
|
---|
[2] | 52 |
|
---|
[15] | 53 | private:
|
---|
| 54 | flair::core::Thread *self;
|
---|
| 55 | flair::core::ConditionVariable *cond;
|
---|
| 56 | uint8_t priority;
|
---|
[213] | 57 | uint32_t stackSize;
|
---|
[186] | 58 | flair::core::Time max_latency, min_latency, mean_latency;
|
---|
[15] | 59 | flair::core::Time last;
|
---|
| 60 | uint64_t cpt;
|
---|
| 61 | flair::core::Time period;
|
---|
| 62 | bool tobestopped;
|
---|
| 63 | bool is_suspended;
|
---|
| 64 | void PrintStats(void);
|
---|
[186] | 65 | void ComputeLatency(flair::core::Time time);
|
---|
[2] | 66 | #ifdef __XENO__
|
---|
[15] | 67 | RT_TASK task_rt;
|
---|
| 68 | static void main_rt(void *arg);
|
---|
[2] | 69 | #else
|
---|
[15] | 70 | pthread_t task_nrt;
|
---|
| 71 | static void *main_nrt(void *arg);
|
---|
| 72 | flair::core::Time next_time;
|
---|
[2] | 73 | #endif
|
---|
| 74 | };
|
---|
| 75 | #endif // THREAD_IMPL_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.