MainThread.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: FMTC do nov 2 13:06:03 CET 2006 MainThread.cpp
3 
4  MainThread.cpp - description
5  -------------------
6  begin : do november 02 2006
7  copyright : (C) 2006 FMTC
8  email : peter.soetens@fmtc.be
9 
10  ***************************************************************************
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public *
13  * License as published by the Free Software Foundation; *
14  * version 2 of the License. *
15  * *
16  * As a special exception, you may use this file as part of a free *
17  * software library without restriction. Specifically, if other files *
18  * instantiate templates or use macros or inline functions from this *
19  * file, or you compile this file and link it with other files to *
20  * produce an executable, this file does not by itself cause the *
21  * resulting executable to be covered by the GNU General Public *
22  * License. This exception does not however invalidate any other *
23  * reasons why the executable file might be covered by the GNU General *
24  * Public License. *
25  * *
26  * This library is distributed in the hope that it will be useful, *
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
29  * Lesser General Public License for more details. *
30  * *
31  * You should have received a copy of the GNU General Public *
32  * License along with this library; if not, write to the Free Software *
33  * Foundation, Inc., 59 Temple Place, *
34  * Suite 330, Boston, MA 02111-1307 USA *
35  * *
36  ***************************************************************************/
37 
38 
39 
40 // this file must be included always first.
42 #include "os/MainThread.hpp"
43 
44 namespace RTT
45 { namespace os {
46 
47  boost::shared_ptr<ThreadInterface> MainThread::mt;
48 
49 
52  }
53 
56  }
57 
59  {
60  if (mt)
61  return mt.get();
62  mt.reset( new MainThread() );
63  return mt.get();
64  }
65 
67  {
68  mt.reset();
69  }
70 
71  bool MainThread::start() { return false; }
72 
73  bool MainThread::stop() { return false; }
74 
75  Seconds MainThread::getPeriod() const { return 0; }
76 
77  nsecs MainThread::getPeriodNS() const { return 0; }
78 
79  bool MainThread::isRunning() const { return true; }
80  bool MainThread::isActive() const { return true; }
81 
82  const char* MainThread::getName() const { return "main"; }
83 
85 
86  const RTOS_TASK * MainThread::getTask() const { return &main_task; }
87 
88  bool MainThread::setScheduler(int sched_type)
89  {
90  if ( rtos_task_set_scheduler(&main_task, sched_type) == 0)
91  return true;
92  return false;
93  }
95  {
97  }
98 
100  {
101  return rtos_task_set_priority(&main_task, p) == 0;
102  }
103 
105  {
107  }
108 
109  unsigned int MainThread::getPid() const
110  {
111  return rtos_task_get_pid(&main_task);
112  }
113 
114  unsigned MainThread::getCpuAffinity() const
115  {
117  }
118 
120  {
121  return false;
122  }
123 
125  {
126  }
127 
129  {
130  return 0;
131  }
132 
134  {
136  }
137 
139  {
141  }
142 
143  unsigned int MainThread::threadNumber() const { return 0; }
144 }}
145 
146 
virtual RTOS_TASK * getTask()
Definition: MainThread.cpp:84
int rtos_task_get_priority(const RTOS_TASK *task)
virtual bool isRunning() const
Definition: MainThread.cpp:79
double Seconds
Definition: os/Time.hpp:53
static ThreadInterface * Instance()
Definition: MainThread.cpp:58
unsigned int rtos_task_get_pid(const RTOS_TASK *task)
virtual bool isActive() const
Definition: MainThread.cpp:80
INTERNAL_QUAL int rtos_task_delete_main(RTOS_TASK *main_task)
int rtos_task_set_scheduler(RTOS_TASK *t, int sched_type)
virtual const char * getName() const
Definition: MainThread.cpp:82
virtual ~MainThread()
Definition: MainThread.cpp:54
virtual bool stop()
Definition: MainThread.cpp:73
unsigned rtos_task_get_cpu_affinity(const RTOS_TASK *task)
virtual unsigned int getPid() const
Definition: MainThread.cpp:109
virtual unsigned getCpuAffinity() const
Definition: MainThread.cpp:114
virtual bool setPriority(int priority)
Definition: MainThread.cpp:99
static void Release()
Definition: MainThread.cpp:66
virtual int getMaxOverrun() const
Definition: MainThread.cpp:128
void rtos_task_set_wait_period_policy(RTOS_TASK *task, int policy)
static boost::shared_ptr< ThreadInterface > mt
Definition: MainThread.hpp:60
virtual int getScheduler() const
Definition: MainThread.cpp:94
INTERNAL_QUAL void rtos_task_yield(RTOS_TASK *)
int rtos_task_set_priority(RTOS_TASK *task, int priority)
virtual int getPriority() const
Definition: MainThread.cpp:104
virtual bool setScheduler(int sched_type)
Definition: MainThread.cpp:88
virtual Seconds getPeriod() const
Definition: MainThread.cpp:75
virtual void setWaitPeriodPolicy(int p)
Definition: MainThread.cpp:133
unsigned int threadNumber() const
Definition: MainThread.cpp:143
virtual void setMaxOverrun(int m)
Definition: MainThread.cpp:124
virtual bool start()
Definition: MainThread.cpp:71
virtual nsecs getPeriodNS() const
Definition: MainThread.cpp:77
virtual void yield()
Definition: MainThread.cpp:138
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
INTERNAL_QUAL int rtos_task_create_main(RTOS_TASK *main_task)
virtual bool setPeriod(Seconds period)
Definition: MainThread.cpp:119
long long nsecs
Definition: os/Time.hpp:69
int rtos_task_get_scheduler(const RTOS_TASK *t)


rtt
Author(s): RTT Developers
autogenerated on Tue Jun 25 2019 19:33:25