Last change
on this file since 197 was 139, checked in by Sanahuja Guillaume, 8 years ago |
warn message if vrpnobject is added on running client
|
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 |
|
---|
24 | namespace flair {
|
---|
25 | namespace core {
|
---|
26 | class Thread;
|
---|
27 | class IODevice;
|
---|
28 | class ConditionVariable;
|
---|
29 | }
|
---|
30 | }
|
---|
31 |
|
---|
32 | class Thread_impl {
|
---|
33 | public:
|
---|
34 | Thread_impl(flair::core::Thread *self, uint8_t priority);
|
---|
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 |
|
---|
53 | private:
|
---|
54 | flair::core::Thread *self;
|
---|
55 | flair::core::ConditionVariable *cond;
|
---|
56 | uint8_t priority;
|
---|
57 | flair::core::Time max_jitter, min_jitter, mean_jitter;
|
---|
58 | flair::core::Time last;
|
---|
59 | uint64_t cpt;
|
---|
60 | flair::core::Time period;
|
---|
61 | bool tobestopped;
|
---|
62 | bool is_suspended;
|
---|
63 | void PrintStats(void);
|
---|
64 | void ComputeJitter(flair::core::Time time);
|
---|
65 | #ifdef __XENO__
|
---|
66 | RT_TASK task_rt;
|
---|
67 | static void main_rt(void *arg);
|
---|
68 | #else
|
---|
69 | pthread_t task_nrt;
|
---|
70 | static void *main_nrt(void *arg);
|
---|
71 | flair::core::Time next_time;
|
---|
72 | #endif
|
---|
73 | };
|
---|
74 | #endif // THREAD_IMPL_H
|
---|
Note:
See
TracBrowser
for help on using the repository browser.