Better thread pool constructor
statically define a number of threads, then setup the necessary machinery to make it work.
This commit is contained in:
14
src/main.cpp
14
src/main.cpp
@@ -116,13 +116,13 @@ int main(void)
|
|||||||
std::string format_str;
|
std::string format_str;
|
||||||
u64 format_str_width = 0;
|
u64 format_str_width = 0;
|
||||||
|
|
||||||
// Init threads
|
// Init threads
|
||||||
std::thread threads[] = {
|
#define THREADS 15
|
||||||
std::thread(cw::worker::worker, std::ref(state)),
|
std::thread threads[THREADS];
|
||||||
std::thread(cw::worker::worker, std::ref(state)),
|
for (auto i = 0; i < THREADS; ++i)
|
||||||
std::thread(cw::worker::worker, std::ref(state)),
|
{
|
||||||
std::thread(cw::worker::worker, std::ref(state)),
|
threads[i] = std::move(std::thread(cw::worker::worker, std::ref(state)));
|
||||||
};
|
}
|
||||||
|
|
||||||
// Setup raylib window
|
// Setup raylib window
|
||||||
InitWindow(WIDTH, HEIGHT, "Calkin-Wilf tree");
|
InitWindow(WIDTH, HEIGHT, "Calkin-Wilf tree");
|
||||||
|
|||||||
Reference in New Issue
Block a user