summaryrefslogtreecommitdiffstats
path: root/rlz/win/lib/lib_mutex.h
blob: d0f0eba33d53e2fb37f9ed5cd05b6dad587a8deb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef RLZ_WIN_LIB_LIB_MUTEX_H_
#define RLZ_WIN_LIB_LIB_MUTEX_H_

#include <windows.h>

namespace rlz_lib {
// Cross-process mutex to guarantee serialization of RLZ key accesses.
class LibMutex {
 public:
  LibMutex();
  ~LibMutex();

  bool failed() const { return !acquired_; }

 private:
  bool acquired_;
  HANDLE mutex_;
};

}  // namespace rlz_lib

#endif  // RLZ_WIN_LIB_LIB_MUTEX_H_