rodecomp/Source/Utility/Async/NAsyncWorkQueue.h
ragnarok-clanker 1d0e5dc05e Maintenance: Add mandatory field offset markers /* XXXX */ and assertions to Utility headers (Async, Math, Threading)
Batch #1057 by ragnarok-clanker: no function's compiled code changes; checked with 75 compiled unit(s), including every includer of Source/Utility/Async/AsyncDiagnostic.h, Source/Utility/Async/NAsyncWorkQueue.h, Source/Utility/Async/NMessageQueue.h, Source/Utility/Async/NRecycleObjectPoolMgr.h, Source/Utility/Math/AffineMatrix.h, Source/Utility/Threading/CSyncObject.h, Source/Utility/Threading/NSyncObject.h.
2026-10-27 13:40:06 +00:00

59 lines
1.5 KiB
C++

#ifndef RAGNAROK_SOURCE_UTILITY_ASYNC_NASYNCWORKQUEUE_H
#define RAGNAROK_SOURCE_UTILITY_ASYNC_NASYNCWORKQUEUE_H
#include "Utility/Async/NAsyncWork.h"
#include <cstddef>
#include <list>
#include <utility>
#include <windows.h>
class NAsyncWorkRequestQueue {
friend class NAsyncWorkThread;
friend class NAsyncWorkMgr;
public:
NAsyncWorkRequestQueue();
virtual ~NAsyncWorkRequestQueue();
NAsyncWorkPtr Pop();
void PushBack(NAsyncWorkPtr& work);
void PushFront(NAsyncWorkPtr& work);
void Complete(std::uint32_t group, std::uint32_t key);
protected:
/* 0004 */ std::list<NAsyncWorkPtr> m_pending;
/* 000C */ std::list<std::pair<std::uint32_t, std::uint32_t>> m_active;
/* 0014 */ std::uint32_t m_waiting;
/* 0018 */ HANDLE m_semaphore;
/* 001C */ CRITICAL_SECTION m_criticalSection;
/* 0034 */ bool m_enabled;
};
struct NAsyncWorkResponse {
/* 0000 */ bool valid;
/* 0004 */ NAsyncWorkPtr work;
};
class NAsyncWorkResponseQueue {
friend class NAsyncWorkMgr;
public:
NAsyncWorkResponseQueue();
virtual ~NAsyncWorkResponseQueue();
NAsyncWorkResponse Pop();
void Push(NAsyncWorkPtr& work);
protected:
/* 0004 */ std::list<NAsyncWorkPtr> m_pending;
/* 000C */ CRITICAL_SECTION m_criticalSection;
/* 0024 */ bool m_enabled;
};
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(NAsyncWorkRequestQueue) == 56);
static_assert(sizeof(NAsyncWorkResponseQueue) == 40);
static_assert(sizeof(NAsyncWorkResponse) == 16);
static_assert(offsetof(NAsyncWorkResponse, work) == 4);
#endif
#endif