Removed dependencies on pthread from frcsim.

Because we want to be able to compile/run wpilibC++Sim on
windows, we would prefer not to require a windows version
of pthread. This commit moves from pthread constructs to
standard library constructs.

Change-Id: I12392a8910189537dd067afdf017e4994d570a66
This commit is contained in:
James Kuszmaul
2015-07-02 14:33:24 -04:00
parent 3f59f3472a
commit 5712565068
17 changed files with 91 additions and 95 deletions

View File

@@ -1,10 +1,17 @@
#pragma once
#include <pthread.h>
// Allows usage with std::unique_lock without including <mutex> separately
#include <mutex>
#ifdef FRC_SIMULATOR
// We do not want to use pthreads if in the simulator; however, in the
// simulator, we do not care about priority inversion.
typedef ::std::mutex priority_mutex;
typedef ::std::recursive_mutex priority_recursive_mutex;
#else // Covers rest of file.
#include <pthread.h>
class priority_recursive_mutex {
public:
typedef pthread_mutex_t *native_handle_type;
@@ -65,3 +72,5 @@ class priority_mutex {
{0, 0, 0, 0x20, 0, {0}}};
#endif
};
#endif // FRC_SIMULATOR