Orocos Real-Time Toolkit  2.9.0
MainThread.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: FMTC do nov 2 13:06:03 CET 2006 MainThread.hpp
3 
4  MainThread.hpp - 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 #ifndef RTT_OS_MAIN_THREAD_HPP
41 #define RTT_OS_MAIN_THREAD_HPP
42 
43 #include "ThreadInterface.hpp"
44 #include <boost/shared_ptr.hpp>
45 
46 namespace RTT
47 { namespace os {
48 
53  : public ThreadInterface
54  {
55  MainThread();
60  static boost::shared_ptr<ThreadInterface> mt;
61  RTOS_TASK main_task;
62  public:
63  virtual ~MainThread();
64 
69  static ThreadInterface* Instance();
70 
75  static void Release();
76 
80  virtual bool start();
81 
85  virtual bool stop();
86 
90  virtual Seconds getPeriod() const;
91 
95  virtual bool setPeriod(Seconds period);
96 
100  virtual nsecs getPeriodNS() const;
101 
105  virtual bool isRunning() const;
106 
110  virtual bool isActive() const;
111 
115  virtual const char* getName() const;
116 
117  virtual RTOS_TASK * getTask();
118 
119  virtual const RTOS_TASK * getTask() const;
120 
121  virtual bool setScheduler(int sched_type);
122 
123  virtual int getScheduler() const;
124 
125  virtual bool setPriority(int priority);
126 
127  virtual int getPriority() const;
128 
129  virtual unsigned int getPid() const;
130 
131  virtual unsigned getCpuAffinity() const;
132 
133  virtual void setMaxOverrun(int m);
134 
135  virtual int getMaxOverrun() const;
136 
137  virtual void setWaitPeriodPolicy(int p);
138 
139  virtual void yield();
140 
144  unsigned int threadNumber() const;
145  protected:
146 
147  };
148 }}
149 
150 #endif
double Seconds
Seconds are stored as a double precision float.
Definition: Time.hpp:53
#define RTT_API
Definition: rtt-config.h:97
A thread which is being run.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52
long long nsecs
nanoseconds as a signed long long.
Definition: Time.hpp:69
Definition: fosi.h:62
A class which represents the main() thread.
Definition: MainThread.hpp:52