Bug 1935611 - Fix libyuv/libpng link failed for loongarch64. r=glandium,tnikkel,ng
[gecko.git] / security / manager / ssl / PSMRunnable.cpp
blobb962f52af33eac2fa903350c3ee8900edfade033
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "PSMRunnable.h"
7 namespace mozilla {
8 namespace psm {
10 SyncRunnableBase::SyncRunnableBase()
11 : Runnable("psm::SyncRunnableBase"), monitor("SyncRunnableBase::monitor") {}
13 nsresult SyncRunnableBase::DispatchToMainThreadAndWait() {
14 nsresult rv;
15 if (NS_IsMainThread()) {
16 RunOnTargetThread();
17 rv = NS_OK;
18 } else {
19 mozilla::MonitorAutoLock lock(monitor);
20 rv = NS_DispatchToMainThread(this);
21 if (NS_SUCCEEDED(rv)) {
22 lock.Wait();
26 return rv;
29 NS_IMETHODIMP
30 SyncRunnableBase::Run() {
31 RunOnTargetThread();
32 mozilla::MonitorAutoLock(monitor).Notify();
33 return NS_OK;
36 nsresult NotifyObserverRunnable::Run() {
37 mObserver->Observe(nullptr, mTopic, nullptr);
38 return NS_OK;
41 } // namespace psm
42 } // namespace mozilla