diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-04-08 18:07:13 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-04-08 18:07:13 +0200 |
commit | f398949b40624488b54b35d446a9b5ac46101739 (patch) | |
tree | 34a8382e793d237a8eaabd65f4afecace06081a0 /src/libutil/sync.hh | |
parent | 05fbc606fc1ce4a764276b7dee6ed49859de9d57 (diff) |
Make LocalStore thread-safe
Necessary for multi-threaded commands like "nix verify-paths".
Diffstat (limited to 'src/libutil/sync.hh')
-rw-r--r-- | src/libutil/sync.hh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libutil/sync.hh b/src/libutil/sync.hh index c99c098ac..ebe64ffbd 100644 --- a/src/libutil/sync.hh +++ b/src/libutil/sync.hh @@ -22,11 +22,11 @@ namespace nix { scope. */ -template<class T> +template<class T, class M = std::mutex> class Sync { private: - std::mutex mutex; + M mutex; T data; public: @@ -38,7 +38,7 @@ public: { private: Sync * s; - std::unique_lock<std::mutex> lk; + std::unique_lock<M> lk; friend Sync; Lock(Sync * s) : s(s), lk(s->mutex) { } public: |