AuroraRuntime/Source/Grug/AuArrow.hpp

39 lines
943 B
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuArrow.hpp
Date: 2022-02-03
Author: Reece
***/
#pragma once
#if defined(AURORA_IS_POSIX_DERIVED)
#define ARROW_NO_MUTEX
#endif
namespace Aurora::Grug
{
struct Arrow;
using GrugReport_f = void(*)(Arrow *);
struct Arrow
{
AuThreadPrimitives::SpinLock spinSemaphore;
#if !defined(ARROW_NO_MUTEX)
AuThreadPrimitives::Mutex spinSemaphore2;
#endif
bool bPermitRunAhead;
GrugThread thread;
GrugReport_f pCallback;
GrugReport_f pCallbackRunaway;
};
void HurlArrow(Arrow *pArrow, GrugReport_f pCallback, GrugReport_f pCallbackRunaway);
void ArrowWait(Arrow *pArrow);
void ArrowThreadAsyncSafe(Arrow *pArrow);
void HurlRaiseProblematicEvent(Arrow *pArrow);
void HurlFatalEvent(Arrow *pArrow);
void DequeueOneArrow();
void DeinitArrows();
}