Skip to content

Commit 30c4add

Browse files
committedJul 12, 2018
std.event.Future: workaround in tests for llvm coro memory
See #1194
1 parent 9751a0a commit 30c4add

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
 

‎std/event.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub const Lock = @import("event/lock.zig").Lock;
44
pub const tcp = @import("event/tcp.zig");
55
pub const Channel = @import("event/channel.zig").Channel;
66
pub const Group = @import("event/group.zig").Group;
7-
pub const Future = @import("event/future.zig").Group;
7+
pub const Future = @import("event/future.zig").Future;
88

99
test "import event tests" {
1010
_ = @import("event/locked.zig");

‎std/event/future.zig

+9
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ test "std.event.Future" {
6767
}
6868

6969
async fn testFuture(loop: *Loop) void {
70+
suspend |p| {
71+
resume p;
72+
}
7073
var future = Future(i32).init(loop);
7174

7275
const a = async waitOnFuture(&future) catch @panic("memory");
@@ -79,10 +82,16 @@ async fn testFuture(loop: *Loop) void {
7982
}
8083

8184
async fn waitOnFuture(future: *Future(i32)) i32 {
85+
suspend |p| {
86+
resume p;
87+
}
8288
return (await (async future.get() catch @panic("memory"))).*;
8389
}
8490

8591
async fn resolveFuture(future: *Future(i32)) void {
92+
suspend |p| {
93+
resume p;
94+
}
8695
future.data = 6;
8796
future.resolve();
8897
}

0 commit comments

Comments
 (0)
Please sign in to comment.