JNetLibray
로딩중...
검색중...
일치하는것 없음
JobHandler.h
이 파일의 문서화 페이지로 가기
1#pragma once
2#include <LockFreeQueue.h>
3#include "CommTypes.h"
4#include "Job.h"
5
6class JobHandler : public std::enable_shared_from_this<JobHandler>
7{
8 using JobRef = Job*;
9
10public:
11 void HandleJob_Async(CallbackType&& callback) {
12 auto job = new Job(std::move(callback));
13 executablePush(job);
14 }
15
16 template<typename T, typename Ret, typename... Args>
17 void HandleJob_Async(Ret(T::* method)(Args...), Args... args)
18 {
19 std::shared_ptr<T> owner = std::static_pointer_cast<T>(shared_from_this());
20 auto job = new Job(owner, method, std::forward<Args>(args)...);
21 executablePush(job);
22 }
23
24
25private:
26 void executablePush(JobRef job);
27
28private:
30 LockFreeQueue<JobRef> m_AllocatedJobs;
31};
32
unsigned __int32 uint32
Definition CommTypes.h:10
std::function< void()> CallbackType
Definition Job.h:8
Definition JobHandler.h:7
LockFreeQueue< JobRef > m_AllocatedJobs
Definition JobHandler.h:30
void HandleJob_Async(CallbackType &&callback)
Definition JobHandler.h:11
Job * JobRef
Definition JobHandler.h:8
void HandleJob_Async(Ret(T::*method)(Args...), Args... args)
Definition JobHandler.h:17
uint32 m_AtomicJobCnt
Definition JobHandler.h:29
void executablePush(JobRef job)
Definition JobHandler.cpp:3
Definition Job.h:11