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

Last change on this file since 2 was 2, checked in by Sanahuja Guillaume, 6 years ago

flaircore

File size: 1.9 KB
RevLine 
[2]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
25{
26    namespace core
27    {
28        class Thread;
29        class IODevice;
30        class ConditionVariable;
31    }
32}
33
34class Thread_impl
35{
36    public:
37        Thread_impl(flair::core::Thread* self,uint8_t priority);
38        ~Thread_impl();
39        void Start(void);
40        void Join(void);
41        void SafeStop(void);
42        bool ToBeStopped(void);
43        void SetPeriodUS(uint32_t period);
44        uint32_t GetPeriodUS(void) const;
45        void SetPeriodMS(uint32_t period);
46        uint32_t GetPeriodMS(void) const;
47        void WaitPeriod(void);
48        void Suspend(void);
49        bool SuspendUntil (flair::core::Time date);
50        void Resume(void);
51        bool IsSuspended(void);
52        int WaitUpdate(const flair::core::IODevice* device);
53        bool period_set;
54
55    private:
56        flair::core::Thread* self;
57        flair::core::ConditionVariable* cond;
58        uint8_t priority;
59        flair::core::Time max_jitter,min_jitter,mean_jitter;
60        flair::core::Time last;
61        uint64_t cpt;
62        flair::core::Time period;
63        bool isRunning;
64        bool tobestopped;
65        bool is_suspended;
66        void PrintStats(void);
67        void ComputeJitter(flair::core::Time time);
68#ifdef __XENO__
69        RT_TASK task_rt;
70        static void main_rt(void * arg);
71#else
72        pthread_t task_nrt;
73        static void* main_nrt(void * arg);
74        flair::core::Time next_time;
75#endif
76};
77#endif // THREAD_IMPL_H
Note: See TracBrowser for help on using the repository browser.