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
11
12#ifndef JXL_THREAD_PARALLEL_RUNNER_CXX_H_
13#define JXL_THREAD_PARALLEL_RUNNER_CXX_H_
14
15#include <memory>
16
17#include "jxl/thread_parallel_runner.h"
18
19#if !(defined(__cplusplus) || defined(c_plusplus))
20#error \
21 "This a C++ only header. Use jxl/jxl_thread_parallel_runner.h from C" \
22 "sources."
23#endif
24
27 struct JxlThreadParallelRunnerDestroyStruct {
29 void operator()(void* runner) { JxlThreadParallelRunnerDestroy(runner); }
30};
31
37 typedef std::unique_ptr<void, JxlThreadParallelRunnerDestroyStruct>
38 JxlThreadParallelRunnerPtr;
39
53 static inline JxlThreadParallelRunnerPtr JxlThreadParallelRunnerMake(
54 const JxlMemoryManager* memory_manager, size_t num_worker_threads) {
55 return JxlThreadParallelRunnerPtr(
56 JxlThreadParallelRunnerCreate(memory_manager, num_worker_threads));
57}
58
59#endif // JXL_THREAD_PARALLEL_RUNNER_CXX_H_
JxlMemoryManagerStruct
Definition: memory_manager.h:48
JxlThreadParallelRunnerDestroyStruct
Definition: thread_parallel_runner_cxx.h:27
JxlThreadParallelRunnerDestroyStruct::operator()
void operator()(void *runner)
Calls JxlThreadParallelRunnerDestroy() on the passed runner.
Definition: thread_parallel_runner_cxx.h:29
thread_parallel_runner.h
implementation using std::thread of a JxlParallelRunner.
JxlThreadParallelRunnerCreate
JXL_THREADS_EXPORT void * JxlThreadParallelRunnerCreate(const JxlMemoryManager *memory_manager, size_t num_worker_threads)
JxlThreadParallelRunnerDestroy
JXL_THREADS_EXPORT void JxlThreadParallelRunnerDestroy(void *runner_opaque)
JxlThreadParallelRunnerPtr
std::unique_ptr< void, JxlThreadParallelRunnerDestroyStruct > JxlThreadParallelRunnerPtr
Definition: thread_parallel_runner_cxx.h:38