Assert on (! shutdown_), function schedule_from_remote
- Dominant language
- C++
- Stars
- 510
- Forks
- 123
- PR merge metrics
- No merged PRs in 30d
Description
While investigating another case just found this assert fired.
Boost fiber from develop branch.
The toy example to reproduce (some time it needs several runs):
```cpp
#include
#include
#include
#include
#include
using namespace std::chrono_literals;
int main()
{
boost::fibers::mutex mtx;
boost::fibers::condition_variable cond;
std::atomic stopping;
std::vector pool;
for (size_t i = 0; i < 10; i++)
{
auto th = std::thread([&] ()
{
boost::fibers::use_scheduling_algorithm();
auto f1 = boost::fibers::fiber([&] () {
int i = 0;
while (!stopping.load())
{
std::cout << "trying to get lock" << std::endl;
std::unique_lock l(mtx);
std::this_thread::sleep_for(100ms);
std::cout << i++ << " waiting" << std::endl;
cond.wait_for(l, 15ms);
std::cout << "worker" << std::endl;
}
});
f1.join();
});
pool.push_back(std::move(th));
}
auto th2 = std::thread([&] ()
{
while (!stopping.load())
{
{
std::unique_lock l(mtx);
cond.notify_all();
}
std::this_thread::sleep_for(1ms);
}
});
std::this_thread::sleep_for(200ms);
stopping.store(true);
for (auto& th : pool)
{
th.join();
}
th2.join();
return 0;
}
```
possible output:
```
trying to get lock
trying to get lock
trying to get lock
trying to get lock
trying to get lock
trying to get lock
trying to get lock
trying to get lock
trying to get lock
trying to get lock
0 waiting
0 waiting
0 waiting
worker
0 waiting
0 waiting
0 waiting
0 waiting
Assertion failed: (! shutdown_), function schedule_from_remote, file libs/fiber/src/scheduler.cpp, line 227.
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.