blob: 25e1b61f633cdcd2d1846888ab33d03ba2431510 [file] [log] [blame]
// Copyright (c) 2011 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.
#include <sys/types.h>
#include <string>
// Platform abstraction for a lock that can be shared between processes.
// The process that owns the lock will release it on exit even if
// the exit is due to a crash. Locks are not recursive.
class MultiProcessLock {
// Factory method for creating a multi-process lock.
// |name| is the name of the lock. The name has special meaning on Windows
// where the prefix can determine the namespace of the lock.
// See for
// details.
static MultiProcessLock* Create(const std::string& name);
virtual ~MultiProcessLock() { }
// Try to grab ownership of the lock.
virtual bool TryLock() = 0;
// Release ownership of the lock.
virtual void Unlock() = 0;