summaryrefslogtreecommitdiffstats
path: root/chrome/tools/crash_service/caps/process_singleton_win.h
blob: 5440d9c0fb3903d0b4e9d64ee5e86524d7ed8f98 (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
27
28
29
30
// Copyright 2015 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 CHROME_TOOLS_CRASH_SERVICE_CAPS_PROCESS_SINGLETON_WIN_H_
#define CHROME_TOOLS_CRASH_SERVICE_CAPS_PROCESS_SINGLETON_WIN_H_

#include <windows.h>

#include "base/macros.h"

namespace caps {
// Uses a named mutex to make sure that only one process of
// with this particular version is launched.
class ProcessSingleton {
public:
  ProcessSingleton();
  ~ProcessSingleton();
  bool other_instance() const { return mutex_ == NULL; }

private:
  HANDLE mutex_;

  DISALLOW_COPY_AND_ASSIGN(ProcessSingleton);
};

}  // namespace caps

#endif  // CHROME_TOOLS_CRASH_SERVICE_CAPS_PROCESS_SINGLETON_WIN_H_