WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
Task.hpp
1 #pragma once
2 
3 #include <stdint.h>
4 #include <pthread.h>
5 
6 #ifndef _FUNCPTR_DEFINED
7 #define _FUNCPTR_DEFINED
8 #ifdef __cplusplus
9 typedef int (*FUNCPTR)(...);
10 /* ptr to function returning int */
11 #else
12 typedef int (*FUNCPTR) (); /* ptr to function returning int */
13 #endif /* __cplusplus */
14 #endif /* _FUNCPTR_DEFINED */
15 
16 #ifndef _STATUS_DEFINED
17 #define _STATUS_DEFINED
18 typedef int STATUS;
19 #endif /* _STATUS_DEFINED */
20 
21 #ifndef OK
22 #define OK 0
23 #endif /* OK */
24 #ifndef ERROR
25 #define ERROR (-1)
26 #endif /* ERROR */
27 
28 #define NULL_TASK NULL
29 typedef pthread_t* TASK;
30 
31 extern "C" {
32  // Note: These constants used to be declared extern and were defined in
33  // Task.cpp. This caused issues with the JNI bindings for java, and so the
34  // instantiations were moved here.
35  const int32_t HAL_taskLib_ILLEGAL_PRIORITY = 22; // 22 is EINVAL
36 
37  STATUS verifyTaskID(TASK task);
38  STATUS setTaskPriority(TASK task, int priority); // valid priority [1..99]
39  STATUS getTaskPriority(TASK task, int* priority);
40 }