Skip to content

Commit ab118fb

Browse files
committed
me trying to solve the timing issue with WorkReq (damnit)
1 parent af93044 commit ab118fb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/uvw/work.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,18 @@ TEST(Work, Cancellation) {
6464
checkWorkEvent = true;
6565
});
6666

67+
auto launcher = [](auto &request) {
68+
struct Cancel {
69+
Cancel(uvw::WorkReq &req): req{req} {}
70+
~Cancel() { req.cancel(); }
71+
uvw::WorkReq &req;
72+
} cancel{request};
73+
74+
return request.queue(), (void)cancel;
75+
};
76+
6777
handle->start();
68-
req->queue();
69-
req->cancel();
78+
launcher(*req);
7079
loop->run();
7180

7281
ASSERT_TRUE(checkErrorEvent);

0 commit comments

Comments
 (0)