| ... | @@ -13,6 +13,7 @@ const net = std.Io.net; | ... | @@ -13,6 +13,7 @@ const net = std.Io.net; |
| 13 | const HostName = std.Io.net.HostName; | 13 | const HostName = std.Io.net.HostName; |
| 14 | const IpAddress = std.Io.net.IpAddress; | 14 | const IpAddress = std.Io.net.IpAddress; |
| 15 | const Allocator = std.mem.Allocator; | 15 | const Allocator = std.mem.Allocator; |
| | 16 | const Alignment = std.mem.Alignment; |
| 16 | const assert = std.debug.assert; | 17 | const assert = std.debug.assert; |
| 17 | const posix = std.posix; | 18 | const posix = std.posix; |
| 18 | | 19 | |
| ... | @@ -387,7 +388,7 @@ const AsyncClosure = struct { | ... | @@ -387,7 +388,7 @@ const AsyncClosure = struct { |
| 387 | func: *const fn (context: *anyopaque, result: *anyopaque) void, | 388 | func: *const fn (context: *anyopaque, result: *anyopaque) void, |
| 388 | reset_event: ResetEvent, | 389 | reset_event: ResetEvent, |
| 389 | select_condition: ?*ResetEvent, | 390 | select_condition: ?*ResetEvent, |
| 390 | context_alignment: std.mem.Alignment, | 391 | context_alignment: Alignment, |
| 391 | result_offset: usize, | 392 | result_offset: usize, |
| 392 | alloc_len: usize, | 393 | alloc_len: usize, |
| 393 | | 394 | |
| ... | @@ -434,9 +435,9 @@ const AsyncClosure = struct { | ... | @@ -434,9 +435,9 @@ const AsyncClosure = struct { |
| 434 | gpa: Allocator, | 435 | gpa: Allocator, |
| 435 | mode: enum { async, concurrent }, | 436 | mode: enum { async, concurrent }, |
| 436 | result_len: usize, | 437 | result_len: usize, |
| 437 | result_alignment: std.mem.Alignment, | 438 | result_alignment: Alignment, |
| 438 | context: []const u8, | 439 | context: []const u8, |
| 439 | context_alignment: std.mem.Alignment, | 440 | context_alignment: Alignment, |
| 440 | func: *const fn (context: *const anyopaque, result: *anyopaque) void, | 441 | func: *const fn (context: *const anyopaque, result: *anyopaque) void, |
| 441 | ) Allocator.Error!*AsyncClosure { | 442 | ) Allocator.Error!*AsyncClosure { |
| 442 | const max_context_misalignment = context_alignment.toByteUnits() -| @alignOf(AsyncClosure); | 443 | const max_context_misalignment = context_alignment.toByteUnits() -| @alignOf(AsyncClosure); |
| ... | @@ -485,9 +486,9 @@ const AsyncClosure = struct { | ... | @@ -485,9 +486,9 @@ const AsyncClosure = struct { |
| 485 | fn async( | 486 | fn async( |
| 486 | userdata: ?*anyopaque, | 487 | userdata: ?*anyopaque, |
| 487 | result: []u8, | 488 | result: []u8, |
| 488 | result_alignment: std.mem.Alignment, | 489 | result_alignment: Alignment, |
| 489 | context: []const u8, | 490 | context: []const u8, |
| 490 | context_alignment: std.mem.Alignment, | 491 | context_alignment: Alignment, |
| 491 | start: *const fn (context: *const anyopaque, result: *anyopaque) void, | 492 | start: *const fn (context: *const anyopaque, result: *anyopaque) void, |
| 492 | ) ?*Io.AnyFuture { | 493 | ) ?*Io.AnyFuture { |
| 493 | if (builtin.single_threaded) { | 494 | if (builtin.single_threaded) { |
| ... | @@ -547,9 +548,9 @@ fn async( | ... | @@ -547,9 +548,9 @@ fn async( |
| 547 | fn concurrent( | 548 | fn concurrent( |
| 548 | userdata: ?*anyopaque, | 549 | userdata: ?*anyopaque, |
| 549 | result_len: usize, | 550 | result_len: usize, |
| 550 | result_alignment: std.mem.Alignment, | 551 | result_alignment: Alignment, |
| 551 | context: []const u8, | 552 | context: []const u8, |
| 552 | context_alignment: std.mem.Alignment, | 553 | context_alignment: Alignment, |
| 553 | start: *const fn (context: *const anyopaque, result: *anyopaque) void, | 554 | start: *const fn (context: *const anyopaque, result: *anyopaque) void, |
| 554 | ) Io.ConcurrentError!*Io.AnyFuture { | 555 | ) Io.ConcurrentError!*Io.AnyFuture { |
| 555 | if (builtin.single_threaded) return error.ConcurrencyUnavailable; | 556 | if (builtin.single_threaded) return error.ConcurrencyUnavailable; |
| ... | @@ -597,7 +598,7 @@ const GroupClosure = struct { | ... | @@ -597,7 +598,7 @@ const GroupClosure = struct { |
| 597 | /// Points to sibling `GroupClosure`. Used for walking the group to cancel all. | 598 | /// Points to sibling `GroupClosure`. Used for walking the group to cancel all. |
| 598 | node: std.SinglyLinkedList.Node, | 599 | node: std.SinglyLinkedList.Node, |
| 599 | func: *const fn (*Io.Group, context: *anyopaque) void, | 600 | func: *const fn (*Io.Group, context: *anyopaque) void, |
| 600 | context_alignment: std.mem.Alignment, | 601 | context_alignment: Alignment, |
| 601 | alloc_len: usize, | 602 | alloc_len: usize, |
| 602 | | 603 | |
| 603 | fn start(closure: *Closure) void { | 604 | fn start(closure: *Closure) void { |
| ... | @@ -638,7 +639,7 @@ const GroupClosure = struct { | ... | @@ -638,7 +639,7 @@ const GroupClosure = struct { |
| 638 | t: *Threaded, | 639 | t: *Threaded, |
| 639 | group: *Io.Group, | 640 | group: *Io.Group, |
| 640 | context: []const u8, | 641 | context: []const u8, |
| 641 | context_alignment: std.mem.Alignment, | 642 | context_alignment: Alignment, |
| 642 | func: *const fn (*Io.Group, context: *const anyopaque) void, | 643 | func: *const fn (*Io.Group, context: *const anyopaque) void, |
| 643 | ) Allocator.Error!*GroupClosure { | 644 | ) Allocator.Error!*GroupClosure { |
| 644 | const max_context_misalignment = context_alignment.toByteUnits() -| @alignOf(GroupClosure); | 645 | const max_context_misalignment = context_alignment.toByteUnits() -| @alignOf(GroupClosure); |
| ... | @@ -678,7 +679,7 @@ fn groupAsync( | ... | @@ -678,7 +679,7 @@ fn groupAsync( |
| 678 | userdata: ?*anyopaque, | 679 | userdata: ?*anyopaque, |
| 679 | group: *Io.Group, | 680 | group: *Io.Group, |
| 680 | context: []const u8, | 681 | context: []const u8, |
| 681 | context_alignment: std.mem.Alignment, | 682 | context_alignment: Alignment, |
| 682 | start: *const fn (*Io.Group, context: *const anyopaque) void, | 683 | start: *const fn (*Io.Group, context: *const anyopaque) void, |
| 683 | ) void { | 684 | ) void { |
| 684 | if (builtin.single_threaded) return start(group, context.ptr); | 685 | if (builtin.single_threaded) return start(group, context.ptr); |
| ... | @@ -794,7 +795,7 @@ fn await( | ... | @@ -794,7 +795,7 @@ fn await( |
| 794 | userdata: ?*anyopaque, | 795 | userdata: ?*anyopaque, |
| 795 | any_future: *Io.AnyFuture, | 796 | any_future: *Io.AnyFuture, |
| 796 | result: []u8, | 797 | result: []u8, |
| 797 | result_alignment: std.mem.Alignment, | 798 | result_alignment: Alignment, |
| 798 | ) void { | 799 | ) void { |
| 799 | _ = result_alignment; | 800 | _ = result_alignment; |
| 800 | const t: *Threaded = @ptrCast(@alignCast(userdata)); | 801 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| ... | @@ -806,7 +807,7 @@ fn cancel( | ... | @@ -806,7 +807,7 @@ fn cancel( |
| 806 | userdata: ?*anyopaque, | 807 | userdata: ?*anyopaque, |
| 807 | any_future: *Io.AnyFuture, | 808 | any_future: *Io.AnyFuture, |
| 808 | result: []u8, | 809 | result: []u8, |
| 809 | result_alignment: std.mem.Alignment, | 810 | result_alignment: Alignment, |
| 810 | ) void { | 811 | ) void { |
| 811 | _ = result_alignment; | 812 | _ = result_alignment; |
| 812 | const t: *Threaded = @ptrCast(@alignCast(userdata)); | 813 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |