fair-acc / opencmw-cpp

Open Common Middle-Ware library for accelerator equipment- and beam-based control systems at FAIR.
https://opencmw.io
GNU Lesser General Public License v3.0
10 stars 8 forks source link

Make MDClientCtx thread-safe #325

Open frankosterfeld opened 1 year ago

frankosterfeld commented 1 year ago

MDClientCtx has some threading issues:

The use of the poller thread calling poll() is not thread-safe:

While at it: if (_subscriptions.contains(receivedEvent.serviceName)) { _subscriptions.at(receivedEvent.serviceName).callback(receivedEvent); // callback } can be replaced by a single lookup (find()) instead of two. Same for _requests below.