mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.Io: rename asyncConcurrent to concurrent
This commit is contained in:
parent
60c4bdb14c
commit
f9d976a4e1
@ -583,7 +583,7 @@ pub const VTable = struct {
|
||||
start: *const fn (context: *const anyopaque, result: *anyopaque) void,
|
||||
) ?*AnyFuture,
|
||||
/// Thread-safe.
|
||||
asyncConcurrent: *const fn (
|
||||
concurrent: *const fn (
|
||||
/// Corresponds to `Io.userdata`.
|
||||
userdata: ?*anyopaque,
|
||||
result_len: usize,
|
||||
@ -1095,7 +1095,7 @@ pub fn Queue(Elem: type) type {
|
||||
/// not guaranteed to be available until `await` is called.
|
||||
///
|
||||
/// `function` *may* be called immediately, before `async` returns. This has
|
||||
/// weaker guarantees than `asyncConcurrent`, making more portable and
|
||||
/// weaker guarantees than `concurrent`, making more portable and
|
||||
/// reusable.
|
||||
///
|
||||
/// See also:
|
||||
@ -1133,7 +1133,7 @@ pub fn async(
|
||||
/// This has stronger guarantee than `async`, placing restrictions on what kind
|
||||
/// of `Io` implementations are supported. By calling `async` instead, one
|
||||
/// allows, for example, stackful single-threaded blocking I/O.
|
||||
pub fn asyncConcurrent(
|
||||
pub fn concurrent(
|
||||
io: Io,
|
||||
function: anytype,
|
||||
args: std.meta.ArgsTuple(@TypeOf(function)),
|
||||
@ -1148,7 +1148,7 @@ pub fn asyncConcurrent(
|
||||
}
|
||||
};
|
||||
var future: Future(Result) = undefined;
|
||||
future.any_future = try io.vtable.asyncConcurrent(
|
||||
future.any_future = try io.vtable.concurrent(
|
||||
io.userdata,
|
||||
@sizeOf(Result),
|
||||
.of(Result),
|
||||
@ -1166,7 +1166,7 @@ pub fn asyncConcurrent(
|
||||
///
|
||||
/// See also:
|
||||
/// * `async`
|
||||
/// * `asyncConcurrent`
|
||||
/// * `concurrent`
|
||||
pub fn asyncDetached(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))) void {
|
||||
const Args = @TypeOf(args);
|
||||
const TypeErased = struct {
|
||||
|
||||
@ -139,7 +139,7 @@ pub fn io(el: *EventLoop) Io {
|
||||
.userdata = el,
|
||||
.vtable = &.{
|
||||
.async = async,
|
||||
.asyncConcurrent = asyncConcurrent,
|
||||
.concurrent = concurrent,
|
||||
.await = await,
|
||||
.asyncDetached = asyncDetached,
|
||||
.select = select,
|
||||
@ -878,13 +878,13 @@ fn async(
|
||||
context_alignment: Alignment,
|
||||
start: *const fn (context: *const anyopaque, result: *anyopaque) void,
|
||||
) ?*std.Io.AnyFuture {
|
||||
return asyncConcurrent(userdata, result.len, result_alignment, context, context_alignment, start) catch {
|
||||
return concurrent(userdata, result.len, result_alignment, context, context_alignment, start) catch {
|
||||
start(context.ptr, result.ptr);
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
fn asyncConcurrent(
|
||||
fn concurrent(
|
||||
userdata: ?*anyopaque,
|
||||
result_len: usize,
|
||||
result_alignment: Alignment,
|
||||
|
||||
@ -99,7 +99,7 @@ pub fn io(pool: *Pool) Io {
|
||||
.userdata = pool,
|
||||
.vtable = &.{
|
||||
.async = async,
|
||||
.asyncConcurrent = asyncConcurrent,
|
||||
.concurrent = concurrent,
|
||||
.await = await,
|
||||
.asyncDetached = asyncDetached,
|
||||
.cancel = cancel,
|
||||
@ -261,7 +261,7 @@ fn async(
|
||||
}
|
||||
const pool: *Pool = @ptrCast(@alignCast(userdata));
|
||||
const cpu_count = pool.cpu_count catch {
|
||||
return asyncConcurrent(userdata, result.len, result_alignment, context, context_alignment, start) catch {
|
||||
return concurrent(userdata, result.len, result_alignment, context, context_alignment, start) catch {
|
||||
start(context.ptr, result.ptr);
|
||||
return null;
|
||||
};
|
||||
@ -325,7 +325,7 @@ fn async(
|
||||
return @ptrCast(closure);
|
||||
}
|
||||
|
||||
fn asyncConcurrent(
|
||||
fn concurrent(
|
||||
userdata: ?*anyopaque,
|
||||
result_len: usize,
|
||||
result_alignment: std.mem.Alignment,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user