source: flair-src/trunk/lib/FlairCore/src/unexported/Thread_impl.h@ 213

Last change on this file since 213 was 213, checked in by Sanahuja Guillaume, 4 years ago

thread stack size rework
add Matrix class

File size: 1.7 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 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
24namespace flair {
25namespace core {
26class Thread;
27class IODevice;
28class ConditionVariable;
29}
30}
31
32class Thread_impl {
33public:
34 Thread_impl(flair::core::Thread *self, uint8_t priority,uint32_t stackSize);
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;
51 bool isRunning;
52
53private:
54 flair::core::Thread *self;
55 flair::core::ConditionVariable *cond;
56 uint8_t priority;
57 uint32_t stackSize;
58 flair::core::Time max_latency, min_latency, mean_latency;
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);
65 void ComputeLatency(flair::core::Time time);
66#ifdef __XENO__
67 RT_TASK task_rt;
68 static void main_rt(void *arg);
69#else
70 pthread_t task_nrt;
71 static void *main_nrt(void *arg);
72 flair::core::Time next_time;
73#endif
74};
75#endif // THREAD_IMPL_H
Note: See TracBrowser for help on using the repository browser.