Loading...
Searching...
No Matches
thread_parallel_runner_cxx.h
Go to the documentation of this file.
// Copyright (c) the JPEG XL Project Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#ifndef JXL_THREAD_PARALLEL_RUNNER_CXX_H_
#define JXL_THREAD_PARALLEL_RUNNER_CXX_H_
#include <jxl/memory_manager.h>
#include <jxl/thread_parallel_runner.h>
#include <cstddef>
#include <memory>
#ifndef __cplusplus
#error \
"This a C++ only header. Use jxl/jxl_thread_parallel_runner.h from C" \
"sources."
#endif
struct JxlThreadParallelRunnerDestroyStruct {
void operator()(void* runner) { JxlThreadParallelRunnerDestroy(runner); }
};
typedef std::unique_ptr<void, JxlThreadParallelRunnerDestroyStruct>
JxlThreadParallelRunnerPtr;
static inline JxlThreadParallelRunnerPtr JxlThreadParallelRunnerMake(
const JxlMemoryManager* memory_manager, size_t num_worker_threads) {
return JxlThreadParallelRunnerPtr(
JxlThreadParallelRunnerCreate(memory_manager, num_worker_threads));
}
#endif // JXL_THREAD_PARALLEL_RUNNER_CXX_H_
JxlMemoryManager
struct JxlMemoryManagerStruct JxlMemoryManager
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.
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.