LIBJXL
thread_parallel_runner_cxx.h
Go to the documentation of this file.
1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file.
5 
14 
15 #ifndef JXL_THREAD_PARALLEL_RUNNER_CXX_H_
16 #define JXL_THREAD_PARALLEL_RUNNER_CXX_H_
17 
18 #include <memory>
19 
21 
22 #if !(defined(__cplusplus) || defined(c_plusplus))
23 #error \
24  "This a C++ only header. Use jxl/jxl_thread_parallel_runner.h from C" \
25  "sources."
26 #endif
27 
32  void operator()(void* runner) { JxlThreadParallelRunnerDestroy(runner); }
33 };
34 
40 typedef std::unique_ptr<void, JxlThreadParallelRunnerDestroyStruct>
42 
56 static inline JxlThreadParallelRunnerPtr JxlThreadParallelRunnerMake(
57  const JxlMemoryManager* memory_manager, size_t num_worker_threads) {
59  JxlThreadParallelRunnerCreate(memory_manager, num_worker_threads));
60 }
61 
62 #endif // JXL_THREAD_PARALLEL_RUNNER_CXX_H_
63 
std::unique_ptr< void, JxlThreadParallelRunnerDestroyStruct > JxlThreadParallelRunnerPtr
Definition: thread_parallel_runner_cxx.h:41
JXL_THREADS_EXPORT void * JxlThreadParallelRunnerCreate(const JxlMemoryManager *memory_manager, size_t num_worker_threads)
JXL_THREADS_EXPORT void JxlThreadParallelRunnerDestroy(void *runner_opaque)
Definition: memory_manager.h:51
Definition: thread_parallel_runner_cxx.h:30
void operator()(void *runner)
Calls JxlThreadParallelRunnerDestroy() on the passed runner.
Definition: thread_parallel_runner_cxx.h:32
implementation using std::thread of a JxlParallelRunner.