Orocos Real-Time Toolkit  2.8.3
ThreadInterface.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Sat May 21 20:15:51 CEST 2005 ThreadInterface.hpp
3 
4  ThreadInterface.hpp - description
5  -------------------
6  begin : Sat May 21 2005
7  copyright : (C) 2005 Peter Soetens
8  email : peter.soetens@mech.kuleuven.ac.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 #ifndef OS_THREAD_INTERFACE_HPP
40 #define OS_THREAD_INTERFACE_HPP
41 
42 #include "fosi.h"
43 #include "threads.hpp"
44 #include "Time.hpp"
45 #include "../rtt-config.h"
46 
47 namespace RTT
48 {
49  namespace os
50  {
57  {
58  public:
60  virtual ~ThreadInterface();
61 
70  virtual bool start() = 0;
71 
80  virtual bool stop() = 0;
81 
85  virtual Seconds getPeriod() const = 0;
86 
92  virtual bool setPeriod(Seconds new_period) = 0;
93 
97  virtual nsecs getPeriodNS() const = 0;
98 
108  virtual bool isRunning() const = 0;
109 
115  virtual bool isActive() const = 0;
116 
120  virtual const char* getName() const = 0;
121 
128  virtual RTOS_TASK * getTask() = 0;
129 
133  virtual const RTOS_TASK * getTask() const = 0;
134 
153  virtual bool setScheduler(int sched_type) = 0;
154 
162  virtual int getScheduler() const = 0;
163 
170  virtual bool setPriority(int priority) = 0;
171 
179  virtual int getPriority() const = 0;
180 
191  virtual unsigned int getPid() const = 0;
192 
196  virtual unsigned getCpuAffinity() const = 0;
197 
198  virtual void setMaxOverrun(int m) = 0;
199 
200  virtual int getMaxOverrun() const = 0;
201 
206  virtual void setWaitPeriodPolicy(int p) = 0;
207 
211  virtual void yield() = 0;
212 
216  unsigned int threadNumber() const
217  {
218  return threadnb;
219  }
220 
221  bool isSelf() const;
222  protected:
228  int threadnb;
229  };
230  }
231 }
232 
233 #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.
int threadnb
Threads are given an unique number, which follows thread creation order.
unsigned int threadNumber() const
The unique thread number (within the same process).
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:51
long long nsecs
nanoseconds as a signed long long.
Definition: Time.hpp:69
Definition: fosi.h:62