I am running into a possible deadlock scenario when running the attached code without HCLIB_LOCALITY_FILE and with two workers.
The promises and waits were executed just fine but it seems like the tasks themselves never finish for some reason. I am able to reproduce this issue about 7 out of 10 runs on my machine. @srirajpaul was also able to reproduce this.
#include <chrono>
#include <cstdint>
#include <iostream>
#include <stdlib.h>
#include <thread>
#include "hclib_cpp.h"
int main(int argc, char** argv) {
const char* deps[] = { "system" };
hclib::launch(deps, 1, []() {
hclib::finish([]() {
hclib::async([]() {
hclib::promise_t<int>* x = new hclib::promise_t<int>();
hclib::promise_t<int>* y = new hclib::promise_t<int>();
hclib::async([y] {
hclib::yield();
y->put(1);
});
hclib::async([x] {
x->get_future()->wait();
});
y->get_future()->wait();
x->put(10);
});
});
std::cout << "all finished " << std::endl;
});
return 0;
}
I am running into a possible deadlock scenario when running the attached code without
HCLIB_LOCALITY_FILEand with two workers.The
promisesandwaitswere executed just fine but it seems like the tasks themselves never finish for some reason. I am able to reproduce this issue about 7 out of 10 runs on my machine. @srirajpaul was also able to reproduce this.