LIBJXL: jxl/thread_parallel_runner_cxx.h Source File

LIBJXL

Loading...
Searching...
No Matches
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 <jxl/memory_manager.h>
19#include <jxl/thread_parallel_runner.h>
20
21#include <cstddef>
22#include <memory>
23
24#if !(defined(__cplusplus) || defined(c_plusplus))
25#error \
26 "This a C++ only header. Use jxl/jxl_thread_parallel_runner.h from C" \
27 "sources."
28#endif
29
32 struct JxlThreadParallelRunnerDestroyStruct {
34 void operator()(void* runner) { JxlThreadParallelRunnerDestroy(runner); }
35};
36
42typedef std::unique_ptr<void, JxlThreadParallelRunnerDestroyStruct>
43 JxlThreadParallelRunnerPtr;
44
58static inline JxlThreadParallelRunnerPtr JxlThreadParallelRunnerMake(
59 const JxlMemoryManager* memory_manager, size_t num_worker_threads) {
60 return JxlThreadParallelRunnerPtr(
61 JxlThreadParallelRunnerCreate(memory_manager, num_worker_threads));
62}
63
64#endif // JXL_THREAD_PARALLEL_RUNNER_CXX_H_
65
JxlThreadParallelRunnerPtr
std::unique_ptr< void, JxlThreadParallelRunnerDestroyStruct > JxlThreadParallelRunnerPtr
Definition thread_parallel_runner_cxx.h:43
JxlThreadParallelRunnerCreate
JXL_THREADS_EXPORT void * JxlThreadParallelRunnerCreate(const JxlMemoryManager *memory_manager, size_t num_worker_threads)
JxlThreadParallelRunnerDestroy
JXL_THREADS_EXPORT void JxlThreadParallelRunnerDestroy(void *runner_opaque)
memory_manager.h
Abstraction functions used by JPEG XL to allocate memory.
JxlMemoryManagerStruct
Definition memory_manager.h:51
JxlThreadParallelRunnerDestroyStruct
Definition thread_parallel_runner_cxx.h:32
JxlThreadParallelRunnerDestroyStruct::operator()
void operator()(void *runner)
Calls JxlThreadParallelRunnerDestroy() on the passed runner.
Definition thread_parallel_runner_cxx.h:34
thread_parallel_runner.h
implementation using std::thread of a JxlParallelRunner.