#if defined(__GNUC__) && \
((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6))
#define _Static_assert(predicate, message) static_assert(predicate, message)
#endif
#include "threadpool-common.h"
#include <pthreadpool.h>
#if defined(_MSC_VER) && defined(_M_ARM64)
#include <arm64intr.h>
#ifndef ARM64_FPCR
extern "C" {
unsigned __int32 __ldar32(unsigned __int32 volatile* _Target);
unsigned __int64 __ldar64(unsigned __int64 volatile* _Target);
void __stlr32(unsigned __int32 volatile* _Target, unsigned __int32 _Value);
void __stlr64(unsigned __int64 volatile* _Target, unsigned __int64 _Value);
}
#endif
#endif
#include "threadpool-atomics.h"
#include "threadpool-utils.h"
#define pthreadpool_allocate …
#define pthreadpool_deallocate …
#define pthreadpool_parallelize …
#include "threadpool-object.h"
#undef pthreadpool_allocate
#undef pthreadpool_deallocate
#undef pthreadpool_parallelize
extern "C" {
PTHREADPOOL_INTERNAL struct pthreadpool* pthreadpool_allocate(
size_t threads_count);
PTHREADPOOL_INTERNAL void pthreadpool_deallocate(
struct pthreadpool* threadpool);
PTHREADPOOL_INTERNAL void pthreadpool_parallelize(
struct pthreadpool* threadpool,
thread_function_t thread_function,
const void* params,
size_t params_size,
void* task,
void* context,
size_t linear_range,
uint32_t flags);
}
#include "base/functional/bind.h"
#include "base/synchronization/lock.h"
#include "base/system/sys_info.h"
#include "base/task/post_job.h"
#include "base/task/task_traits.h"
constexpr size_t kMaxNumWorkItems = …;
class PthreadPoolJob { … };
struct pthreadpool* pthreadpool_create(size_t threads_count) { … }
PTHREADPOOL_INTERNAL void pthreadpool_parallelize(
struct pthreadpool* threadpool,
thread_function_t thread_function,
const void* params,
size_t params_size,
void* task,
void* context,
size_t linear_range,
uint32_t flags) { … }
void pthreadpool_destroy(struct pthreadpool* threadpool) { … }