1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
11 # include "nsTString.h"
20 explicit WaitForMutex(HANDLE handle
) : mHandle(handle
), mStatus(false) {
24 dwWaitResult
= WaitForSingleObject(mHandle
, // handle to mutex
25 INFINITE
); // no time-out interval
27 switch (dwWaitResult
) {
28 // The thread got ownership of the mutex
33 // The thread got ownership of an abandoned mutex
34 // The shmem is in an indeterminate state
45 if (mHandle
&& !ReleaseMutex(mHandle
)) {
46 # ifdef MOZILLA_INTERNAL_API
48 msg
.AppendPrintf("WaitForMutex %d ReleaseMutex error \"%lu\".", mHandle
,
50 NS_WARNING(msg
.get());
52 MOZ_ASSERT(false, "Failed to release mutex.");
56 bool GetStatus() { return mStatus
; }
65 } // namespace mozilla
67 #endif /* GFX_VR_MUTEX_H */