Last active
March 9, 2021 16:52
-
-
Save lhorie/12b0b39697a87fc8444ea288b325f773 to your computer and use it in GitHub Desktop.
zig async recursion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// test.zig | |
const std = @import("std"); | |
pub const io_mode = .evented; | |
pub fn main() void { | |
parse("/somefile"); | |
} | |
fn parse(file: []const u8) void { | |
const f = std.fs.openFileAbsolute(file, .{ .read = true }) catch return; | |
if (file.len != 0) parse(""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
solution appears to be to allocate the recursive frame in heap, like so:
thanks @fengb