mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-11 02:13:57 -04:00
AP_HAL_Linux: make all semaphores recursive
the cost is very similar and this prevents an easy coding error which can occur on less used code paths
This commit is contained in:
parent
f683741a9c
commit
4b9442dad7
@ -8,12 +8,6 @@ using namespace Linux;
|
|||||||
|
|
||||||
// construct a semaphore
|
// construct a semaphore
|
||||||
Semaphore::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_t attr;
|
||||||
pthread_mutexattr_init(&attr);
|
pthread_mutexattr_init(&attr);
|
||||||
|
@ -18,9 +18,4 @@ protected:
|
|||||||
pthread_mutex_t _lock;
|
pthread_mutex_t _lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Semaphore_Recursive : public Semaphore {
|
|
||||||
public:
|
|
||||||
Semaphore_Recursive();
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user