Initial checkin of unified hierarchy of WPILib 2015

This commit is contained in:
Brad Miller
2013-12-15 18:30:16 -05:00
commit 3178911eef
1560 changed files with 410007 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
#include "OSAL/Synchronized.h"
#include <stdlib.h>
pthread_mutexattr_t mta;
bool hasInit = false;
NTSynchronized::NTSynchronized(NTReentrantSemaphore& semaphore):m_semaphore(semaphore)
{
m_semaphore.take();
}
NTSynchronized::~NTSynchronized()
{
m_semaphore.give();
}

View File

@@ -0,0 +1,29 @@
/*
* System.cpp
*
* Created on: Sep 26, 2012
* Author: Mitchell Wills
*/
#include "networktables2/util/System.h"
#include <sys/time.h>
#include <unistd.h>
#include <iostream>
void sleep_ms(unsigned long ms){
while(ms>500){
usleep(500*1000);
ms-=500;
}
usleep(ms*1000);
}
unsigned long currentTimeMillis(){//TODO improve
struct timeval tv;
if (gettimeofday(&tv, NULL) != 0){
return -1;
}
return ((tv.tv_sec % 86400) * 1000 + tv.tv_usec / 1000);
}
void writeWarning(const char* message){
std::cerr << message;
}