2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// Copyright The Music Player Daemon Project
|
2016-03-05 18:49:42 +01:00
|
|
|
|
|
|
|
#include "MaskMonitor.hxx"
|
|
|
|
|
|
|
|
void
|
2019-04-04 19:49:00 +02:00
|
|
|
MaskMonitor::OrMask(unsigned new_mask) noexcept
|
2016-03-05 18:49:42 +01:00
|
|
|
{
|
|
|
|
if (pending_mask.fetch_or(new_mask) == 0)
|
2020-12-01 16:25:11 +01:00
|
|
|
event.Schedule();
|
2016-03-05 18:49:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-11-10 21:09:54 +01:00
|
|
|
MaskMonitor::RunDeferred() noexcept
|
2016-03-05 18:49:42 +01:00
|
|
|
{
|
|
|
|
const unsigned mask = pending_mask.exchange(0);
|
|
|
|
if (mask != 0)
|
2016-06-17 17:00:05 +02:00
|
|
|
callback(mask);
|
2016-03-05 18:49:42 +01:00
|
|
|
}
|