mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 00:31:14 +00:00
Device: synchronize access to transports container
This commit is contained in:
parent
ae7bc6fc6c
commit
7bf1d368a8
|
@ -650,6 +650,8 @@ bool Device::HandleMultipartInput(const string& chName, const InputMultipartCall
|
|||
|
||||
shared_ptr<TransportFactory> Device::AddTransport(mq::Transport transport)
|
||||
{
|
||||
lock_guard<mutex> lock(fTransportMtx);
|
||||
|
||||
if (transport == mq::Transport::DEFAULT) {
|
||||
transport = fDefaultTransportType;
|
||||
}
|
||||
|
@ -769,6 +771,7 @@ void Device::LogSocketRates()
|
|||
|
||||
void Device::InterruptTransports()
|
||||
{
|
||||
lock_guard<mutex> lock(fTransportMtx);
|
||||
for (auto& [transportType, transport] : fTransports) {
|
||||
transport->Interrupt();
|
||||
}
|
||||
|
@ -776,6 +779,7 @@ void Device::InterruptTransports()
|
|||
|
||||
void Device::ResumeTransports()
|
||||
{
|
||||
lock_guard<mutex> lock(fTransportMtx);
|
||||
for (auto& [transportType, transport] : fTransports) {
|
||||
transport->Resume();
|
||||
}
|
||||
|
@ -792,14 +796,17 @@ void Device::ResetTaskWrapper()
|
|||
|
||||
void Device::ResetWrapper()
|
||||
{
|
||||
for (auto& [transportType, transport] : fTransports) {
|
||||
transport->Reset();
|
||||
{
|
||||
lock_guard<mutex> lock(fTransportMtx);
|
||||
for (auto& [transportType, transport] : fTransports) {
|
||||
transport->Reset();
|
||||
}
|
||||
fTransports.clear();
|
||||
}
|
||||
|
||||
Reset();
|
||||
|
||||
fChannels.clear();
|
||||
fTransports.clear();
|
||||
fTransportFactory.reset();
|
||||
if (!NewStatePending()) {
|
||||
ChangeState(Transition::Auto);
|
||||
|
|
|
@ -637,6 +637,7 @@ class Device
|
|||
|
||||
StateQueue fStateQueue;
|
||||
|
||||
std::mutex fTransportMtx; ///< guards access to transports container
|
||||
std::mutex fTransitionMtx;
|
||||
bool fTransitioning;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user