Bug 1769628 [wpt PR 34081] - Update wpt metadata, a=testonly
[gecko.git] / mozglue / misc / ConditionVariable_noop.cpp
blob4b28861650214780bba60f398840103b2f1dc204
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/. */
7 #include "mozilla/Assertions.h"
9 #include "mozilla/PlatformConditionVariable.h"
10 #include "mozilla/PlatformMutex.h"
11 #include "MutexPlatformData_noop.h"
13 using mozilla::TimeDuration;
15 struct mozilla::detail::ConditionVariableImpl::PlatformData {};
17 mozilla::detail::ConditionVariableImpl::ConditionVariableImpl() {}
19 mozilla::detail::ConditionVariableImpl::~ConditionVariableImpl() {}
21 void mozilla::detail::ConditionVariableImpl::notify_one() {}
23 void mozilla::detail::ConditionVariableImpl::notify_all() {}
25 void mozilla::detail::ConditionVariableImpl::wait(MutexImpl&) {
26 // On WASI, there are no threads, so we never wait (either the condvar must
27 // be ready or there is a deadlock).
30 mozilla::CVStatus mozilla::detail::ConditionVariableImpl::wait_for(
31 MutexImpl&, const TimeDuration&) {
32 return CVStatus::NoTimeout;
35 mozilla::detail::ConditionVariableImpl::PlatformData*
36 mozilla::detail::ConditionVariableImpl::platformData() {
37 static_assert(sizeof platformData_ >= sizeof(PlatformData),
38 "platformData_ is too small");
39 return reinterpret_cast<PlatformData*>(platformData_);