update comments for nosuspend

This commit is contained in:
Tadeo Kondrak 2020-05-05 05:19:17 -06:00
parent 2c9204032d
commit fdfdac4939
No known key found for this signature in database
GPG Key ID: D41E092CA43F1D8B
3 changed files with 9 additions and 9 deletions

View File

@ -248,7 +248,7 @@ fn readUnitLength(in_stream: var, endian: builtin.Endian, is_64: *bool) !u64 {
}
}
// TODO the noasyncs here are workarounds
// TODO the nosuspends here are workarounds
fn readAllocBytes(allocator: *mem.Allocator, in_stream: var, size: usize) ![]u8 {
const buf = try allocator.alloc(u8, size);
errdefer allocator.free(buf);
@ -256,7 +256,7 @@ fn readAllocBytes(allocator: *mem.Allocator, in_stream: var, size: usize) ![]u8
return buf;
}
// TODO the noasyncs here are workarounds
// TODO the nosuspends here are workarounds
fn readAddress(in_stream: var, endian: builtin.Endian, is_64: bool) !u64 {
return nosuspend if (is_64)
try in_stream.readInt(u64, endian)
@ -269,7 +269,7 @@ fn parseFormValueBlockLen(allocator: *mem.Allocator, in_stream: var, size: usize
return FormValue{ .Block = buf };
}
// TODO the noasyncs here are workarounds
// TODO the nosuspends here are workarounds
fn parseFormValueBlock(allocator: *mem.Allocator, in_stream: var, endian: builtin.Endian, size: usize) !FormValue {
const block_len = try nosuspend in_stream.readVarInt(usize, endian, size);
return parseFormValueBlockLen(allocator, in_stream, block_len);
@ -277,7 +277,7 @@ fn parseFormValueBlock(allocator: *mem.Allocator, in_stream: var, endian: builti
fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: var, signed: bool, endian: builtin.Endian, comptime size: i32) !FormValue {
// TODO: Please forgive me, I've worked around zig not properly spilling some intermediate values here.
// `noasync` should be removed from all the function calls once it is fixed.
// `nosuspend` should be removed from all the function calls once it is fixed.
return FormValue{
.Const = Constant{
.signed = signed,
@ -301,7 +301,7 @@ fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: var, signed: boo
};
}
// TODO the noasyncs here are workarounds
// TODO the nosuspends here are workarounds
fn parseFormValueRef(allocator: *mem.Allocator, in_stream: var, endian: builtin.Endian, size: i32) !FormValue {
return FormValue{
.Ref = switch (size) {
@ -315,7 +315,7 @@ fn parseFormValueRef(allocator: *mem.Allocator, in_stream: var, endian: builtin.
};
}
// TODO the noasyncs here are workarounds
// TODO the nosuspends here are workarounds
fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endian: builtin.Endian, is_64: bool) anyerror!FormValue {
return switch (form_id) {
FORM_addr => FormValue{ .Address = try readAddress(in_stream, endian, @sizeOf(usize) == 8) },

View File

@ -21,7 +21,7 @@ pub fn Batch(
/// usual recommended option for this parameter.
auto_async,
/// Always uses the `noasync` keyword when using `await` on the jobs,
/// Always uses the `nosuspend` keyword when using `await` on the jobs,
/// making `add` and `wait` non-async functions. Asserts that the jobs do not suspend.
never_async,

View File

@ -66,7 +66,7 @@ pub const File = struct {
lock_nonblocking: bool = false,
/// Setting this to `.blocking` prevents `O_NONBLOCK` from being passed even
/// if `std.io.is_async`. It allows the use of `noasync` when calling functions
/// if `std.io.is_async`. It allows the use of `nosuspend` when calling functions
/// related to opening the file, reading, writing, and locking.
intended_io_mode: io.ModeOverride = io.default_mode,
};
@ -112,7 +112,7 @@ pub const File = struct {
mode: Mode = default_mode,
/// Setting this to `.blocking` prevents `O_NONBLOCK` from being passed even
/// if `std.io.is_async`. It allows the use of `noasync` when calling functions
/// if `std.io.is_async`. It allows the use of `nosuspend` when calling functions
/// related to opening the file, reading, writing, and locking.
intended_io_mode: io.ModeOverride = io.default_mode,
};