mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-16 01:51:45 +00:00
SDK: Fix data races on the local semaphores
This commit is contained in:
committed by
Dennis Klein
parent
5d6184cd1a
commit
1c49dde668
@@ -39,7 +39,7 @@ auto Semaphore::Signal() -> void
|
||||
fCv.notify_one();
|
||||
}
|
||||
|
||||
auto Semaphore::GetCount() -> std::size_t
|
||||
auto Semaphore::GetCount() const -> std::size_t
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(fMutex);
|
||||
return fCount;
|
||||
@@ -63,7 +63,7 @@ auto SharedSemaphore::Signal() -> void
|
||||
fSemaphore->Signal();
|
||||
}
|
||||
|
||||
auto SharedSemaphore::GetCount() -> std::size_t
|
||||
auto SharedSemaphore::GetCount() const -> std::size_t
|
||||
{
|
||||
return fSemaphore->GetCount();
|
||||
}
|
||||
|
@@ -30,11 +30,11 @@ struct Semaphore
|
||||
|
||||
auto Wait() -> void;
|
||||
auto Signal() -> void;
|
||||
auto GetCount() -> std::size_t;
|
||||
auto GetCount() const -> std::size_t;
|
||||
|
||||
private:
|
||||
std::size_t fCount;
|
||||
std::mutex fMutex;
|
||||
mutable std::mutex fMutex;
|
||||
std::condition_variable fCv;
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@ struct SharedSemaphore
|
||||
|
||||
auto Wait() -> void;
|
||||
auto Signal() -> void;
|
||||
auto GetCount() -> std::size_t;
|
||||
auto GetCount() const -> std::size_t;
|
||||
|
||||
private:
|
||||
std::shared_ptr<Semaphore> fSemaphore;
|
||||
|
Reference in New Issue
Block a user