-
Notifications
You must be signed in to change notification settings - Fork 0
/
if_threadpool.hpp
43 lines (36 loc) · 1.18 KB
/
if_threadpool.hpp
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
32
33
34
35
36
37
38
39
40
41
42
43
/**
* @file if_threadpool.hpp
* @author Jens Munk Hansen <[email protected]>
* @date Sun Jul 1 23:40:35 2018
*
* @brief
*
* Copyright 2018 Jens Munk Hansen
*/
#pragma once
#include <sps/sps_export.h>
#include <cstddef>
namespace sps {
typedef void (*SimpleCallback)(void*);
class SPS_EXPORT IThreadPool {
public:
virtual int Initialize() = 0;
virtual int SubmitJob(SimpleCallback cb, void* pUserData) = 0;
virtual ~IThreadPool() = default;
// If you start to default functions - no longer a pure virtual interface
// and you need to provide a default ctor
// IThreadPool(IThreadPool&& other) = default;
// IThreadPool& operator=(IThreadPool&& other) = default;
protected:
// If you add ctors, you must define em
// IThreadPool() = default;
// IThreadPool(const std::size_t nThreads);
private:
// If you start to delete functions - no longer a pure virtual interface
// and you need to provide a default ctor
// IThreadPool(const IThreadPool& other) = delete;
// IThreadPool& operator=(const IThreadPool& other) = delete;
};
SPS_EXPORT int ThreadPoolCreate(IThreadPool** ppObj);
SPS_EXPORT int ThreadPoolDestroy(IThreadPool* pObj);
} // namespace sps