aboutsummaryrefslogtreecommitdiff
path: root/zenhttp/iothreadpool.h
blob: f64868540e0b4d0d5f1194b960e5baddd41b483e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include <zencore/windows.h>

namespace zen {

//////////////////////////////////////////////////////////////////////////
//
// Thread pool. Implemented in terms of Windows thread pool right now, will
//				need a cross-platform implementation eventually
//

class WinIoThreadPool
{
public:
	WinIoThreadPool(int InThreadCount);
	~WinIoThreadPool();

	void		  CreateIocp(HANDLE IoHandle, PTP_WIN32_IO_CALLBACK Callback, void* Context);
	inline PTP_IO Iocp() const { return m_ThreadPoolIo; }

private:
	PTP_POOL			m_ThreadPool   = nullptr;
	PTP_CLEANUP_GROUP	m_CleanupGroup = nullptr;
	PTP_IO				m_ThreadPoolIo = nullptr;
	TP_CALLBACK_ENVIRON m_CallbackEnvironment;
};

}  // namespace zen