std.Io: rename asyncConcurrent to concurrent

This commit is contained in:
Andrew Kelley 2025-09-26 18:22:37 -07:00
parent 60c4bdb14c
commit f9d976a4e1
3 changed files with 11 additions and 11 deletions

View File

@ -583,7 +583,7 @@ pub const VTable = struct {
start: *const fn (context: *const anyopaque, result: *anyopaque) void, start: *const fn (context: *const anyopaque, result: *anyopaque) void,
) ?*AnyFuture, ) ?*AnyFuture,
/// Thread-safe. /// Thread-safe.
asyncConcurrent: *const fn ( concurrent: *const fn (
/// Corresponds to `Io.userdata`. /// Corresponds to `Io.userdata`.
userdata: ?*anyopaque, userdata: ?*anyopaque,
result_len: usize, result_len: usize,
@ -1095,7 +1095,7 @@ pub fn Queue(Elem: type) type {
/// not guaranteed to be available until `await` is called. /// not guaranteed to be available until `await` is called.
/// ///
/// `function` *may* be called immediately, before `async` returns. This has /// `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. /// reusable.
/// ///
/// See also: /// See also:
@ -1133,7 +1133,7 @@ pub fn async(
/// This has stronger guarantee than `async`, placing restrictions on what kind /// This has stronger guarantee than `async`, placing restrictions on what kind
/// of `Io` implementations are supported. By calling `async` instead, one /// of `Io` implementations are supported. By calling `async` instead, one
/// allows, for example, stackful single-threaded blocking I/O. /// allows, for example, stackful single-threaded blocking I/O.
pub fn asyncConcurrent( pub fn concurrent(
io: Io, io: Io,
function: anytype, function: anytype,
args: std.meta.ArgsTuple(@TypeOf(function)), args: std.meta.ArgsTuple(@TypeOf(function)),
@ -1148,7 +1148,7 @@ pub fn asyncConcurrent(
} }
}; };
var future: Future(Result) = undefined; var future: Future(Result) = undefined;
future.any_future = try io.vtable.asyncConcurrent( future.any_future = try io.vtable.concurrent(
io.userdata, io.userdata,
@sizeOf(Result), @sizeOf(Result),
.of(Result), .of(Result),
@ -1166,7 +1166,7 @@ pub fn asyncConcurrent(
/// ///
/// See also: /// See also:
/// * `async` /// * `async`
/// * `asyncConcurrent` /// * `concurrent`
pub fn asyncDetached(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))) void { pub fn asyncDetached(io: Io, function: anytype, args: std.meta.ArgsTuple(@TypeOf(function))) void {
const Args = @TypeOf(args); const Args = @TypeOf(args);
const TypeErased = struct { const TypeErased = struct {

View File

@ -139,7 +139,7 @@ pub fn io(el: *EventLoop) Io {
.userdata = el, .userdata = el,
.vtable = &.{ .vtable = &.{
.async = async, .async = async,
.asyncConcurrent = asyncConcurrent, .concurrent = concurrent,
.await = await, .await = await,
.asyncDetached = asyncDetached, .asyncDetached = asyncDetached,
.select = select, .select = select,
@ -878,13 +878,13 @@ fn async(
context_alignment: Alignment, context_alignment: Alignment,
start: *const fn (context: *const anyopaque, result: *anyopaque) void, start: *const fn (context: *const anyopaque, result: *anyopaque) void,
) ?*std.Io.AnyFuture { ) ?*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); start(context.ptr, result.ptr);
return null; return null;
}; };
} }
fn asyncConcurrent( fn concurrent(
userdata: ?*anyopaque, userdata: ?*anyopaque,
result_len: usize, result_len: usize,
result_alignment: Alignment, result_alignment: Alignment,

View File

@ -99,7 +99,7 @@ pub fn io(pool: *Pool) Io {
.userdata = pool, .userdata = pool,
.vtable = &.{ .vtable = &.{
.async = async, .async = async,
.asyncConcurrent = asyncConcurrent, .concurrent = concurrent,
.await = await, .await = await,
.asyncDetached = asyncDetached, .asyncDetached = asyncDetached,
.cancel = cancel, .cancel = cancel,
@ -261,7 +261,7 @@ fn async(
} }
const pool: *Pool = @ptrCast(@alignCast(userdata)); const pool: *Pool = @ptrCast(@alignCast(userdata));
const cpu_count = pool.cpu_count catch { 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); start(context.ptr, result.ptr);
return null; return null;
}; };
@ -325,7 +325,7 @@ fn async(
return @ptrCast(closure); return @ptrCast(closure);
} }
fn asyncConcurrent( fn concurrent(
userdata: ?*anyopaque, userdata: ?*anyopaque,
result_len: usize, result_len: usize,
result_alignment: std.mem.Alignment, result_alignment: std.mem.Alignment,