Browse Source

AP_HAL_SITL: make all semaphores recursive

the cost is very similar and this prevents an easy coding error which
can occur on less used code paths
c415-sdk
Andrew Tridgell 5 years ago
parent
commit
4aa78dc891
  1. 1
      libraries/AP_HAL_SITL/AP_HAL_SITL_Namespace.h
  2. 6
      libraries/AP_HAL_SITL/Semaphores.cpp
  3. 8
      libraries/AP_HAL_SITL/Semaphores.h

1
libraries/AP_HAL_SITL/AP_HAL_SITL_Namespace.h

@ -12,7 +12,6 @@ class ADCSource; @@ -12,7 +12,6 @@ class ADCSource;
class RCInput;
class Util;
class Semaphore;
class Semaphore_Recursive;
class GPIO;
class DigitalSource;
class HALSITLCAN;

6
libraries/AP_HAL_SITL/Semaphores.cpp

@ -11,12 +11,6 @@ using namespace HALSITL; @@ -11,12 +11,6 @@ using namespace HALSITL;
// construct a semaphore
Semaphore::Semaphore()
{
pthread_mutex_init(&_lock, nullptr);
}
// construct a recursive semaphore (allows a thread to take it more than once)
Semaphore_Recursive::Semaphore_Recursive()
{
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);

8
libraries/AP_HAL_SITL/Semaphores.h

@ -16,11 +16,3 @@ public: @@ -16,11 +16,3 @@ public:
protected:
pthread_mutex_t _lock;
};
class HALSITL::Semaphore_Recursive : public HALSITL::Semaphore {
public:
Semaphore_Recursive();
};

Loading…
Cancel
Save