Grok 20.3.2
grk_thread_pool.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2026 Grok Image Compression Inc.
3 *
4 * This source code is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License, version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This source code is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Affero General Public License for more details.
12 *
13 * You should have received a copy of the GNU Affero General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#pragma once
19
20#include "grok.h"
21#include "grk_taskflow.h"
22
23namespace grk
24{
25
32inline tf::Executor& executor()
33{
34 return *static_cast<tf::Executor*>(grk_thread_pool());
35}
36
40inline size_t num_workers()
41{
42 return grk_num_workers();
43}
44
50inline uint32_t worker_id()
51{
52 return grk_worker_id();
53}
54
55} // namespace grk
uint32_t grk_worker_id(void)
Returns the TaskFlow worker id of the calling thread.
Definition grok.cpp:236
size_t grk_num_workers(void)
Returns the number of worker threads in the core thread pool.
Definition grok.cpp:231
void * grk_thread_pool(void)
Returns an opaque handle to the core thread-pool executor.
Definition grok.cpp:226
ResWindow.
Definition CompressedChunkCache.h:36
uint32_t worker_id()
Returns the TaskFlow worker id of the calling thread.
Definition grk_thread_pool.h:50
tf::Executor & executor()
Returns a reference to the core library's tf::Executor.
Definition grk_thread_pool.h:32
size_t num_workers()
Returns the total number of worker threads in the core pool.
Definition grk_thread_pool.h:40