120 std::function<
void(
int id, int64_t
b, int64_t e)>&& task,
130 std::function<
void(int64_t, int64_t)>&& task,
133 auto wrapper = [&](
int id, int64_t
b, int64_t e) { task(b, e); };
154 std::function<
void(int64_t
index)>&& task,
172 std::function<
void(
int id, int64_t index)>&& task,
185 template<
class InputIt,
class UnaryFunction>
192 for ( ; first != last; ++
first) {
193 if (opt.singlethread() || opt.pool->very_busy()) {
199 ts.
push (opt.pool->push ([&](
int id){ f(*first); }));
224 int64_t ystart, int64_t yend, int64_t ychunksize,
225 std::function<
void(
int id, int64_t, int64_t,
226 int64_t, int64_t)>&& task,
236 int64_t ystart, int64_t yend, int64_t ychunksize,
237 std::function<
void(int64_t, int64_t,
238 int64_t, int64_t)>&& task,
241 auto wrapper = [&](
int id, int64_t xb, int64_t xe,
242 int64_t yb, int64_t ye) { task(xb,xe,yb,ye); };
244 ystart, yend, ychunksize, wrapper, opt);
260 int64_t ystart, int64_t yend,
261 std::function<
void(
int id, int64_t i, int64_t j)>&& task,
265 [&task](
int id, int64_t xb, int64_t xe, int64_t yb, int64_t ye) {
266 for (
auto y = yb;
y < ye; ++
y)
267 for (
auto x = xb;
x < xe; ++
x)
285 int64_t ystart, int64_t yend,
286 std::function<
void(int64_t i, int64_t j)>&& task,
290 [&task](
int id, int64_t xb, int64_t xe, int64_t yb, int64_t ye) {
291 for (
auto y = yb;
y < ye; ++
y)
292 for (
auto x = xb;
x < xe; ++
x)
304 int64_t ystart, int64_t yend, int64_t ychunksize,
305 std::function<
void(
int id, int64_t i, int64_t j)>&& task)
308 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))
GLuint const GLchar * name
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)
bool is_worker(std::thread::id id)
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.
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
UnaryFunction parallel_for_each(InputIt first, InputIt last, UnaryFunction f, parallel_options opt=parallel_options(0, Split_Y, 1))
OIIO_API thread_pool * default_thread_pool()
parallel_options(int maxthreads=0, SplitDir splitdir=Split_Y, size_t minitems=16384)
int size() const
How many threads are in the pool?
SplitDir
Split strategies.
GLdouble GLdouble GLdouble b
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
#define OIIO_NAMESPACE_BEGIN