MCPcopy Create free account
hub / github.com/RenderKit/embree / steal_loop

Method steal_loop

common/tasking/taskschedulerinternal.cpp:19–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18 template<typename Predicate, typename Body>
19 __forceinline void TaskScheduler::steal_loop(Thread& thread, const Predicate& pred, const Body& body)
20 {
21 while (true)
22 {
23 /*! some rounds that yield */
24 for (size_t i=0; i<32; i++)
25 {
26 /*! some spinning rounds */
27 const size_t threadCount = thread.threadCount();
28 for (size_t j=0; j<1024; j+=threadCount)
29 {
30 if (!pred()) return;
31 if (thread.scheduler->steal_from_other_threads(thread)) {
32 i=j=0;
33 body();
34 }
35 }
36 yield();
37 }
38 }
39 }
40
41 /*! run this task */
42 void TaskScheduler::Task::run_internal (Thread& thread) // FIXME: avoid as many dll_exports as possible

Callers

nothing calls this directly

Calls 3

yieldFunction · 0.85
threadCountMethod · 0.45

Tested by

no test coverage detected