authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-07-11 20:17:47-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-07-11 20:17:47-04:00
log30c4add85a0f4af727ad7cf8f2134114329d0f07
tree4ba5d502074df031b3bc55f0f5a347294888d81c
parent9751a0ae045110fb615c866b94ad47680b9c48c7

std.event.Future: workaround in tests for llvm coro memory

See #1194

2 files changed, 10 insertions(+), 1 deletions(-)

std/event.zig+1-1
......@@ -4,7 +4,7 @@ pub const Lock = @import("event/lock.zig").Lock;
44pub const tcp = @import("event/tcp.zig");
55pub const Channel = @import("event/channel.zig").Channel;
66pub const Group = @import("event/group.zig").Group;
7pub const Future = @import("event/future.zig").Group;
7pub const Future = @import("event/future.zig").Future;
88
99test "import event tests" {
1010 _ = @import("event/locked.zig");
std/event/future.zig+9
......@@ -67,6 +67,9 @@ test "std.event.Future" {
6767}
6868
6969async 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
8184async fn waitOnFuture(future: *Future(i32)) i32 {
85 suspend |p| {
86 resume p;
87 }
8288 return (await (async future.get() catch @panic("memory"))).*;
8389}
8490
8591async fn resolveFuture(future: *Future(i32)) void {
92 suspend |p| {
93 resume p;
94 }
8695 future.data = 6;
8796 future.resolve();
8897}