mirror of
https://github.com/ZmnSCPxj/clboss.git
synced 2026-08-13 12:33:20 +02:00
26 lines
504 B
C++
26 lines
504 B
C++
#undef NDEBUG
|
|
#include<assert.h>
|
|
#include"Ev/Io.hpp"
|
|
#include"Ev/concurrent.hpp"
|
|
#include"Ev/start.hpp"
|
|
#include"Ev/yield.hpp"
|
|
|
|
int main() {
|
|
auto flag1 = bool(false);
|
|
auto flag2 = bool(false);
|
|
auto ec = Ev::start(Ev::yield().then([&]() {
|
|
return Ev::concurrent(Ev::yield().then([&]() {
|
|
flag1 = true;
|
|
return Ev::lift();
|
|
}));
|
|
}).then([&]() {
|
|
/* Concurrent task not started yet. */
|
|
assert(!flag1);
|
|
flag2 = true;
|
|
return Ev::lift(0);
|
|
}));
|
|
assert(flag1);
|
|
assert(flag2);
|
|
|
|
return ec;
|
|
}
|