rodecomp/Source/Utility/Async/NAsyncWorkQueue.h
ragnarok-clanker a47d20f8be Reconstruct readable C++ and organize cohesive source subsystems
Administrative source import: native x86 compilation passed for 423 authored units. Source placement and submission states are migrated separately; this commit does not imply peer acceptance.

Previous head: 35d2a8cb36
Payload SHA256: 592f016d2730c5593bb653aa054c1e5f76a6df72c8f5a09e66f74876e2e33dee
2026-10-25 07:42:41 +00:00

57 lines
1.4 KiB
C++

#ifndef RAGNAROK_SOURCE_UTILITY_ASYNC_NASYNCWORKQUEUE_H
#define RAGNAROK_SOURCE_UTILITY_ASYNC_NASYNCWORKQUEUE_H
#include "Utility/Async/NAsyncWork.h"
#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 {
bool valid;
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);
#endif
#endif