the serialIO dataIO breaks the windows usual habit of one user per IO thing, by letting the dataIO handle be passed around between different classes, which is a veryvery useful and good thing. But to prevent race conditions between different classes, a mutex that can be obtained (ofc in the manner that the user has to take care of looking if the mutex is locked on use) seems useful
so my proposal is to implement two more functions, like lock and unlock and optionally one more bit like force_locked_operation(if set, a warning is returned when an unlocked write/read operation is performed, could also be tied to the debug flag)
Function should be like
class foo-> claims lock(timeout)
class foo writes
class foo reads
class foo-> unlocks
merely like the QMutex functionality.
this function should be optional to use(that's why the force_locked_operation bit).
It's mostly interesting for multipurpose/multifunctioning uControllerprojects where it's not possible to having a composite device stack on the device side, but having different device abstractions on PC/hostside is useful.
But the implied overhead is too much for simple projects.