Dss locking refactored to io service thread.
The code runs on my pc, it connects to ds485 bus, I can use the PC web UI.
This is not definitely not the form suitable for merge. This is only the result of my feasibility research phase.
What is here?
-
ds::asio::Mutex
primitive implementing mutual exclusion by synchronizingasio
io service thread - All threads working with model classes acquire the mutex after start
- mutex is dropped in sleep calls
- mutex is dropped in calls to dsm-api calls. But the ds485 connection shared by more threads still has its own mutex because dsm-api is not thread safe.
- condition variables withing dss are switched to use asio mutex. Not making this leads to dead locks.
Ideas
- It would be nice to add support to print stack trace of other thread in order to simplify debugging of blocking calls. I pays back in simplified debugging.
- Review remaining mutexes whether they are still needed. They should not hurt as long as they are locked after asio lock is locked and unlocked before asio lock is unlocked.