94 std::function<
void(
int id, int64_t
b, int64_t e)>&& task,
104 std::function<
void(int64_t, int64_t)>&& task,
107 auto wrapper = [&](
int , int64_t
b, int64_t e) { task(b, e); };
128 std::function<
void(int64_t
index)>&& task,
146 std::function<
void(
int id, int64_t index)>&& task,
159 template<
class InputIt,
class UnaryFunction>
167 if (opt.singlethread() || opt.pool->very_busy()) {
173 ts.
push (opt.pool->push ([&](
int ){ f(*first); }));
198 int64_t ystart, int64_t yend, int64_t ychunksize,
199 std::function<
void(
int id, int64_t, int64_t,
200 int64_t, int64_t)>&& task,
210 int64_t ystart, int64_t yend, int64_t ychunksize,
211 std::function<
void(int64_t, int64_t,
212 int64_t, int64_t)>&& task,
215 auto wrapper = [&](
int , int64_t xb, int64_t xe,
216 int64_t yb, int64_t ye) { task(xb,xe,yb,ye); };
218 ystart, yend, ychunksize, wrapper, opt);
234 int64_t ystart, int64_t yend,
235 std::function<
void(
int id, int64_t i, int64_t
j)>&& task,
239 [&task](
int id, int64_t xb, int64_t xe, int64_t yb, int64_t ye) {
240 for (
auto y = yb;
y < ye; ++
y)
241 for (
auto x = xb;
x < xe; ++
x)
259 int64_t ystart, int64_t yend,
260 std::function<
void(int64_t i, int64_t
j)>&& task,
264 [&task](
int , int64_t xb, int64_t xe, int64_t yb, int64_t ye) {
265 for (
auto y = yb;
y < ye; ++
y)
266 for (
auto x = xb;
x < xe; ++
x)
278 int64_t ystart, int64_t yend, int64_t ,
279 std::function<
void(
int id, int64_t i, int64_t
j)>&& task)
282 std::forward<std::function<
void(
int,int64_t,int64_t)>>(task));
void parallel_for(int64_t start, int64_t end, std::function< void(int64_t index)> &&task, parallel_options opt=parallel_options(0, Split_Y, 1))
OIIO_UTIL_API thread_pool * default_thread_pool()
Encapsulation of options that control parallel_image().
OIIO_API void parallel_for_chunked(int64_t start, int64_t end, int64_t chunksize, std::function< void(int id, int64_t b, int64_t e)> &&task, parallel_options opt=parallel_options(0, Split_Y, 1))
OIIO_API void parallel_for_chunked_2D(int64_t xstart, int64_t xend, int64_t xchunksize, int64_t ystart, int64_t yend, int64_t ychunksize, std::function< void(int id, int64_t, int64_t, int64_t, int64_t)> &&task, parallel_options opt=0)
String-related utilities, all in namespace Strutil.
bool singlethread() const
void parallel_for_2D(int64_t xstart, int64_t xend, int64_t ystart, int64_t yend, std::function< void(int id, int64_t i, int64_t j)> &&task, parallel_options opt=0)
Wrappers and utilities for multithreading.
UnaryFunction parallel_for_each(InputIt first, InputIt last, UnaryFunction f, parallel_options opt=parallel_options(0, Split_Y, 1))
parallel_options(int maxthreads=0, SplitDir splitdir=Split_Y, size_t minitems=16384)
GLuint const GLchar * name
GLboolean GLboolean GLboolean b
int size() const
How many threads are in the pool?
SplitDir
Split strategies.
__hostdev__ uint64_t last(uint32_t i) const
void push(std::future< void > &&f)
parallel_options(string_view name, int maxthreads=0, SplitDir splitdir=Split_Y, size_t minitems=16384)
#define OIIO_NAMESPACE_END
bool is_worker(std::thread::id id) const
#define OIIO_NAMESPACE_BEGIN