#include #include #include #include #include #include #include "test_scaffold.h" #include #include #include #include #include #include #include using namespace std::chrono_literals; using weight_t = float; template struct node { node(T _value) : value(_value) {} std::vector, weight_t>> next_links; T value; }; struct point { float x, y; }; std::thread* leaver_4989487; std::atomic_int quit_signal_4989487 = 0; gp::system::system* sys_ptr_4989487; struct channel_test : public test_scaffold { channel_test() { name = __FILE__ ":1"; } std::unique_ptr< gp::array, std::default_delete> > store = std::make_unique>(); gp::buddy<> alloc{&*store->begin(), store->size()}; gp::system::simple_scheduling sched{}; gp::system::system& sys = *(new(alloc.allocate(sizeof(gp::system::system))) gp::system::system{alloc, sched}); struct terminator{}; virtual int run() { std::atomic_int a = 0; sys_ptr_4989487 = &sys; sys.spawn(gp::function{[&](){ a.fetch_add(1); }, alloc}); sys.spawn(gp::function{[&](){ while(!quit_signal_4989487.load()) { std::this_thread::sleep_for(500us); } pthread_exit(nullptr); }, alloc}); sys.run([](gp::function a) { leaver_4989487 = new std::thread(a); }); leaver_4989487->detach(); std::this_thread::sleep_for(16ms); gp_config::assertion(a.load(), "did not increment (aka run the fiber)"); return 0; } virtual ~channel_test() { quit_signal_4989487.store(1); std::this_thread::sleep_for(1s); } }; append_test dummy_hke41r43(new channel_test{});