blob: 3feeec8fc20a664c1cd9cd935b0d559c804740f6 [file] [log] [blame]
Brian Silverman26e4e522015-12-17 01:56:40 -05001#pragma once
2
3#include <stdint.h>
4#include <pthread.h>
5
6#ifndef _FUNCPTR_DEFINED
7#define _FUNCPTR_DEFINED
8#ifdef __cplusplus
9typedef int (*FUNCPTR)(...);
10/* ptr to function returning int */
11#else
12typedef int (*FUNCPTR) (); /* ptr to function returning int */
13#endif /* __cplusplus */
14#endif /* _FUNCPTR_DEFINED */
15
16#ifndef _STATUS_DEFINED
17#define _STATUS_DEFINED
18typedef 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
29typedef pthread_t* TASK;
30
31extern "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}