MeVisLab Toolbox Reference
ThreadPool.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3
4#pragma once
5
6#include <asio/System.h>
7#include <asio/Context.h>
8
9#include <FMEThirdPartyWarningsDisable.h>
10#include <vector>
11#include <thread>
12#include <memory>
13#include <FMEThirdPartyWarningsRestore.h>
14
15
16namespace asio {
17
29 {
30 public:
31
32 ThreadPool(std::shared_ptr<Context> context, const unsigned short num_threads);
33
35
36 ThreadPool(const ThreadPool&) = delete;
37
38 ThreadPool& operator=(const ThreadPool&) = delete;
39
40 private:
41
42 std::shared_ptr<Context> context;
43 std::shared_ptr<Context::work> work;
44
45 std::vector<std::thread> pool;
46 };
47
48}
#define ASYNCHRONOUSIO_EXPORT
Definition System.h:10
A thread pool executing an asio::Context's run method with a bunch of threads.
Definition ThreadPool.h:29
ThreadPool(const ThreadPool &)=delete
ThreadPool & operator=(const ThreadPool &)=delete
ThreadPool(std::shared_ptr< Context > context, const unsigned short num_threads)
Target mlrange_cast(Source arg)
Generic version of checked ML casts.