HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_ThreadIOPool.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_ThreadIOPool.h
7  *
8  * COMMENTS:
9  *
10  *
11  */
12 
13 #ifndef __UT_THREADIOPOOL_H__
14 #define __UT_THREADIOPOOL_H__
15 
16 #include "UT_API.h"
17 
18 #include "UT_BoostAsio.h"
19 
20 #include "UT_Lock.h"
21 #include "UT_Thread.h"
22 #include "UT_UniquePtr.h"
23 
25 {
26 public:
27  static UT_ThreadIOPool& instance();
28 
29  ASIO_IOContext& context() { return myIOContext; }
30 
31  void stop();
32  void start(int nthreads);
33 
34 private:
35  UT_ThreadIOPool() = default;
36 
37  mutable UT_Lock myLock;
39  ASIO_IOContext myIOContext;
40  UT_UniquePtr<hboost::asio::executor_work_guard<
41  hboost::asio::io_context::executor_type>>
42  myIOWorkGuard;
43 };
44 
45 #endif // __UT_THREADIOPOOL_H__
46 
GLuint start
Definition: glcorearb.h:475
#define UT_API
Definition: UT_API.h:14
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
ASIO_IOContext & context()
hboost::asio::io_context ASIO_IOContext
Definition: UT_BoostAsio.h:74