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/. */
16 explicit WaitForMutex(HANDLE handle
) : mHandle(handle
), mStatus(false) {
20 dwWaitResult
= WaitForSingleObject(mHandle
, // handle to mutex
21 INFINITE
); // no time-out interval
23 switch (dwWaitResult
) {
24 // The thread got ownership of the mutex
29 // The thread got ownership of an abandoned mutex
30 // The shmem is in an indeterminate state
41 if (mHandle
&& !ReleaseMutex(mHandle
)) {
42 # ifdef MOZILLA_INTERNAL_API
44 msg
.AppendPrintf("WaitForMutex %d ReleaseMutex error \"%lu\".", mHandle
,
46 NS_WARNING(msg
.get());
48 MOZ_ASSERT(false, "Failed to release mutex.");
52 bool GetStatus() { return mStatus
; }
61 } // namespace mozilla
63 #endif /* GFX_VR_MUTEX_H */