Files
allwpilib/hal/include/HAL/Semaphore.hpp
Tyler Veness fd4c169658 artf4149: Removed references to VxWorks
Implemented setTaskPriority() and getTaskPriority() in Task HAL API

Removed all other unimplemented functions in HAL and removed spawnTask()

Replaced instances of pthread_t* with TASK typedef

Removed unused HAL error constants and removed commented-out classes and functions in wpilibj's HALLibrary

Changed Task class API to match the construction semantics of a std::thread

Change-Id: I3bc951a3da90d24c5589fae4d1ca2bb60225c873
2015-07-20 11:49:29 -04:00

43 lines
1.1 KiB
C++

#pragma once
#include <stdint.h>
#include <pthread.h>
#include <semaphore.h>
typedef pthread_mutex_t* MUTEX_ID;
typedef sem_t* SEMAPHORE_ID;
typedef pthread_cond_t* MULTIWAIT_ID;
extern "C"
{
extern const uint32_t SEMAPHORE_Q_FIFO;
extern const uint32_t SEMAPHORE_Q_PRIORITY;
extern const uint32_t SEMAPHORE_DELETE_SAFE;
extern const uint32_t SEMAPHORE_INVERSION_SAFE;
extern const int32_t SEMAPHORE_NO_WAIT;
extern const int32_t SEMAPHORE_WAIT_FOREVER;
extern const uint32_t SEMAPHORE_EMPTY;
extern const uint32_t SEMAPHORE_FULL;
MUTEX_ID initializeMutexRecursive();
MUTEX_ID initializeMutexNormal();
void deleteMutex(MUTEX_ID sem);
int8_t takeMutex(MUTEX_ID sem);
int8_t tryTakeMutex(MUTEX_ID sem);
int8_t giveMutex(MUTEX_ID sem);
SEMAPHORE_ID initializeSemaphore(uint32_t initial_value);
void deleteSemaphore(SEMAPHORE_ID sem);
int8_t takeSemaphore(SEMAPHORE_ID sem);
int8_t tryTakeSemaphore(SEMAPHORE_ID sem);
int8_t giveSemaphore(SEMAPHORE_ID sem);
MULTIWAIT_ID initializeMultiWait();
void deleteMultiWait(MULTIWAIT_ID sem);
int8_t takeMultiWait(MULTIWAIT_ID sem, MUTEX_ID m, int32_t timeout);
int8_t giveMultiWait(MULTIWAIT_ID sem);
}