Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / rlz / win / lib / lib_mutex.cc
blobd20fe2161ef0dfe4472b25f625e48568f3aa850a
1 // Copyright (c) 2012 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 #include "rlz/win/lib/lib_mutex.h"
7 #include <windows.h>
8 #include "base/win/windows_version.h"
10 namespace {
12 const long kTimeoutMs = 5000L;
13 const wchar_t kMutexName[] = L"{A946A6A9-917E-4949-B9BC-6BADA8C7FD63}";
15 } // namespace
17 namespace rlz_lib {
19 LibMutex::LibMutex() : acquired_(false), mutex_(NULL) {
20 mutex_ = CreateMutex(NULL, FALSE, kMutexName);
21 if (mutex_)
22 acquired_ = (WAIT_OBJECT_0 == WaitForSingleObject(mutex_, kTimeoutMs));
25 LibMutex::~LibMutex() {
26 if (acquired_)
27 ReleaseMutex(mutex_);
28 if (mutex_)
29 CloseHandle(mutex_);
32 } // namespace rlz_lib