WPILib  2014.0
WPIRoboticsLibraryforFRC
 All Classes Functions Variables Pages
Task.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2008. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
5 /*----------------------------------------------------------------------------*/
6 
7 #ifndef __TASK_H__
8 #define __TASK_H__
9 
10 #include "ErrorBase.h"
11 #include <vxWorks.h>
12 
17 class Task : public ErrorBase
18 {
19 public:
20  static const uint32_t kDefaultPriority = 101;
21  static const int32_t kInvalidTaskID = -1;
22 
23  Task(const char* name, FUNCPTR function, int32_t priority = kDefaultPriority, uint32_t stackSize = 20000);
24  virtual ~Task();
25 
26  bool Start(uint32_t arg0 = 0, uint32_t arg1 = 0, uint32_t arg2 = 0, uint32_t arg3 = 0, uint32_t arg4 = 0,
27  uint32_t arg5 = 0, uint32_t arg6 = 0, uint32_t arg7 = 0, uint32_t arg8 = 0, uint32_t arg9 = 0);
28  bool Restart();
29  bool Stop();
30 
31  bool IsReady();
32  bool IsSuspended();
33 
34  bool Suspend();
35  bool Resume();
36 
37  bool Verify();
38 
39  int32_t GetPriority();
40  bool SetPriority(int32_t priority);
41  const char* GetName();
42  int32_t GetID();
43 
44 private:
45  FUNCPTR m_function;
46  char* m_taskName;
47  int32_t m_taskID;
48  uint32_t m_stackSize;
49  int m_priority;
50  bool HandleError(STATUS results);
51  DISALLOW_COPY_AND_ASSIGN(Task);
52 };
53 
54 #endif // __TASK_H__
int32_t GetID()
Definition: Task.cpp:175
const char * GetName()
Definition: Task.cpp:166
bool SetPriority(int32_t priority)
Definition: Task.cpp:156
Definition: ErrorBase.h:37
bool Suspend()
Definition: Task.cpp:114
bool Resume()
Definition: Task.cpp:123
bool IsReady()
Definition: Task.cpp:96
Task(const char *name, FUNCPTR function, int32_t priority=kDefaultPriority, uint32_t stackSize=20000)
Definition: Task.cpp:26
bool Stop()
Definition: Task.cpp:81
int32_t GetPriority()
Definition: Task.cpp:141
bool IsSuspended()
Definition: Task.cpp:105
Definition: Task.h:17
bool Verify()
Definition: Task.cpp:132
bool Start(uint32_t arg0=0, uint32_t arg1=0, uint32_t arg2=0, uint32_t arg3=0, uint32_t arg4=0, uint32_t arg5=0, uint32_t arg6=0, uint32_t arg7=0, uint32_t arg8=0, uint32_t arg9=0)
Definition: Task.cpp:52
bool Restart()
Definition: Task.cpp:72