Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / common / multi_process_lock.h
blob25e1b61f633cdcd2d1846888ab33d03ba2431510
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_COMMON_MULTI_PROCESS_LOCK_H_
6 #define CHROME_COMMON_MULTI_PROCESS_LOCK_H_
8 #include <sys/types.h>
9 #include <string>
11 // Platform abstraction for a lock that can be shared between processes.
12 // The process that owns the lock will release it on exit even if
13 // the exit is due to a crash. Locks are not recursive.
14 class MultiProcessLock {
15 public:
17 // Factory method for creating a multi-process lock.
18 // |name| is the name of the lock. The name has special meaning on Windows
19 // where the prefix can determine the namespace of the lock.
20 // See http://msdn.microsoft.com/en-us/library/aa382954(v=VS.85).aspx for
21 // details.
22 static MultiProcessLock* Create(const std::string& name);
24 virtual ~MultiProcessLock() { }
26 // Try to grab ownership of the lock.
27 virtual bool TryLock() = 0;
29 // Release ownership of the lock.
30 virtual void Unlock() = 0;
33 #endif // CHROME_COMMON_MULTI_PROCESS_LOCK_H_