fermi-ad/vxpp

Update the mutex-protected variable API

Opened this issue · 1 comments

The mutex-protected variable API only works properly with primitive types. It would be nice for it to also work with structures, objects and containers. Any solution needs to be as efficient as working with the underlying variable directly. We're only looking for a way to add compile-time checks.

This was originally posted on Redmine (https://cdcvs.fnal.gov/redmine/issues/11624).

Rust solves this problem perfectly: https://doc.rust-lang.org/std/sync/struct.Mutex.html

I'm not sure whether we can do this in C++, though.