2018-11-04 17:51:27 +00:00
|
|
|
#include <mesosphere/core/KSynchronizationObject.hpp>
|
|
|
|
#include <mesosphere/core/Result.hpp>
|
2018-11-08 00:04:06 +00:00
|
|
|
#include <mesosphere/threading/KScopedCriticalSection.hpp>
|
2018-11-04 17:51:27 +00:00
|
|
|
#include <mesosphere/threading/KThread.hpp>
|
|
|
|
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
namespace mesosphere
|
|
|
|
{
|
|
|
|
|
|
|
|
KSynchronizationObject::~KSynchronizationObject()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-11-05 11:47:15 +00:00
|
|
|
void KSynchronizationObject::NotifyWaiters()
|
2018-11-04 17:51:27 +00:00
|
|
|
{
|
2018-11-05 12:57:50 +00:00
|
|
|
KScopedCriticalSection criticalSection;
|
2018-11-04 17:51:27 +00:00
|
|
|
|
|
|
|
if (IsSignaled()) {
|
|
|
|
for (auto &&waiter : waiters) {
|
|
|
|
waiter->HandleSyncObjectSignaled(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
KLinkedList<KThread *>::const_iterator KSynchronizationObject::AddWaiter(KThread &thread)
|
|
|
|
{
|
|
|
|
return waiters.insert(waiters.end(), &thread);
|
|
|
|
}
|
|
|
|
|
|
|
|
void KSynchronizationObject::RemoveWaiter(KLinkedList<KThread *>::const_iterator it)
|
|
|
|
{
|
|
|
|
waiters.erase(it);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|