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
This commit is contained in:
Tyler Veness
2014-08-14 00:07:02 -07:00
committed by James Kuszmaul
parent 5712565068
commit fd4c169658
41 changed files with 214 additions and 647 deletions

View File

@@ -50,28 +50,21 @@ DriverStation::DriverStation() {
AddToSingletonList();
// They need to be identical or it could lead to runtime stack corruption if
// the caller and callee push and pop different amounts of data on the stack.
static_assert(sizeof(this) == sizeof(uint32_t),
"We are passing a pointer through a uint32_t");
if (!m_task.Start((uint32_t) this)) {
wpi_setWPIError(DriverStationTaskError);
}
m_task = Task("DriverStation", &DriverStation::Run, this);
}
DriverStation::~DriverStation() {
m_task.Stop();
m_isRunning = false;
m_task.join();
// Unregister our semaphore.
HALSetNewDataSem(nullptr);
}
// XXX: This assumes that the calling convention treats pointers and uint32_ts
// identical, which is not necessarily true.
void DriverStation::InitTask(DriverStation* ds) { ds->Run(); }
void DriverStation::Run() {
m_isRunning = true;
int period = 0;
while (true) {
while (m_isRunning) {
{
std::unique_lock<priority_mutex> lock(m_packetDataAvailableMutex);
m_packetDataAvailableCond.wait(lock);