mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Moves the HAL priority_ custom types to the hal namespace (#532)
There is a shim for backwards compatibility, just like the frc namespace. As with the frc namespace, the library compiles without the shim.
This commit is contained in:
committed by
Peter Johnson
parent
16e71eac43
commit
efec0c5cc3
@@ -11,14 +11,18 @@
|
||||
#include <mutex>
|
||||
|
||||
#if defined(FRC_SIMULATOR) || defined(_WIN32)
|
||||
namespace hal {
|
||||
// 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;
|
||||
} // namespace hal
|
||||
#else // Covers rest of file.
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
namespace hal {
|
||||
|
||||
class priority_recursive_mutex {
|
||||
public:
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
@@ -77,5 +81,12 @@ class priority_mutex {
|
||||
pthread_mutex_t m_mutex = {{0, 0, 0, 0x20, 0, {0}}};
|
||||
#endif
|
||||
};
|
||||
} // namespace hal
|
||||
|
||||
#endif // FRC_SIMULATOR
|
||||
|
||||
// For backwards compatibility
|
||||
#ifndef NAMESPACED_PRIORITY
|
||||
using priority_mutex = hal::priority_mutex; // NOLINT
|
||||
using priority_recursive_mutex = hal::priority_recursive_mutex; // NOLINT
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user