ReviewOS

also looking at this

craft-native/craft

fix(ios): report async pool exhaustion as busy

#267
Merged glennmichael123 wants to merge codex/ios-busy-error-code into main
19 files +53 -65
packages/zig/src/bridge_mobile_filepicker.zigmodified+4-7
Changes to packages/zig/src/bridge_mobile_filepicker.zig
@@ -428,7 +428,7 @@ pub const FilePickerBridge = struct {
428428 "pending reply; refusing the second call rather than stranding the first",
429429 .{},
430430 );
431 return BridgeError.InvalidParameter;
431 return BridgeError.Busy;
432432 }
433433
434434 const PresentFn = *const fn (Id, Id, Id, bool, Id) callconv(.c) void;
@@ -543,7 +543,7 @@ pub const FilePickerBridge = struct {
543543 "downloadFile: no free reply slot; {d} native calls are already awaiting one",
544544 .{ios_async.max_in_flight},
545545 );
546 return BridgeError.NativeCallFailed;
546 return BridgeError.Busy;
547547 };
548548 errdefer ios_async.abandon(ticket);
549549
@@ -562,13 +562,10 @@ pub const FilePickerBridge = struct {
562562 }
563563};
564564
565/// The answer for a full block pool, in the shape `bridge_mobile_location.zig`
566/// uses: `BridgeError` has no "Busy", `INVALID_PARAMETER` is the migration
567/// notes' designated stand-in, and the point is that the seventeenth concurrent
568/// call gets an explicit rejection instead of a promise that never settles.
565/// Reject a call when every asynchronous reply slot is already in use.
569566fn poolFull() BridgeError {
570567 std.log.warn("pickFile refused: all {d} async slots in flight", .{ios_async.max_in_flight});
571 return BridgeError.InvalidParameter;
568 return BridgeError.Busy;
572569}
573570
574571fn selector(name: [*:0]const u8) !Id {