| ... | @@ -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 | |
| ... | @@ -399,7 +400,7 @@ const AsyncClosure = struct { | ... | @@ -399,7 +400,7 @@ const AsyncClosure = struct { |
| 399 | func: *const fn (context: *anyopaque, result: *anyopaque) void, | 400 | func: *const fn (context: *anyopaque, result: *anyopaque) void, |
| 400 | reset_event: ResetEvent, | 401 | reset_event: ResetEvent, |
| 401 | select_condition: ?*ResetEvent, | 402 | select_condition: ?*ResetEvent, |
| 402 | context_alignment: std.mem.Alignment, | 403 | context_alignment: Alignment, |
| 403 | result_offset: usize, | 404 | result_offset: usize, |
| 404 | alloc_len: usize, | 405 | alloc_len: usize, |
| 405 | | 406 | |
| ... | @@ -445,9 +446,9 @@ const AsyncClosure = struct { | ... | @@ -445,9 +446,9 @@ const AsyncClosure = struct { |
| 445 | fn init( | 446 | fn init( |
| 446 | gpa: Allocator, | 447 | gpa: Allocator, |
| 447 | result_len: usize, | 448 | result_len: usize, |
| 448 | result_alignment: std.mem.Alignment, | 449 | result_alignment: Alignment, |
| 449 | context: []const u8, | 450 | context: []const u8, |
| 450 | context_alignment: std.mem.Alignment, | 451 | context_alignment: Alignment, |
| 451 | func: *const fn (context: *const anyopaque, result: *anyopaque) void, | 452 | func: *const fn (context: *const anyopaque, result: *anyopaque) void, |
| 452 | ) Allocator.Error!*AsyncClosure { | 453 | ) Allocator.Error!*AsyncClosure { |
| 453 | const max_context_misalignment = context_alignment.toByteUnits() -| @alignOf(AsyncClosure); | 454 | const max_context_misalignment = context_alignment.toByteUnits() -| @alignOf(AsyncClosure); |
| ... | @@ -492,9 +493,9 @@ const AsyncClosure = struct { | ... | @@ -492,9 +493,9 @@ const AsyncClosure = struct { |
| 492 | fn async( | 493 | fn async( |
| 493 | userdata: ?*anyopaque, | 494 | userdata: ?*anyopaque, |
| 494 | result: []u8, | 495 | result: []u8, |
| 495 | result_alignment: std.mem.Alignment, | 496 | result_alignment: Alignment, |
| 496 | context: []const u8, | 497 | context: []const u8, |
| 497 | context_alignment: std.mem.Alignment, | 498 | context_alignment: Alignment, |
| 498 | start: *const fn (context: *const anyopaque, result: *anyopaque) void, | 499 | start: *const fn (context: *const anyopaque, result: *anyopaque) void, |
| 499 | ) ?*Io.AnyFuture { | 500 | ) ?*Io.AnyFuture { |
| 500 | const t: *Threaded = @ptrCast(@alignCast(userdata)); | 501 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| ... | @@ -544,9 +545,9 @@ fn async( | ... | @@ -544,9 +545,9 @@ fn async( |
| 544 | fn concurrent( | 545 | fn concurrent( |
| 545 | userdata: ?*anyopaque, | 546 | userdata: ?*anyopaque, |
| 546 | result_len: usize, | 547 | result_len: usize, |
| 547 | result_alignment: std.mem.Alignment, | 548 | result_alignment: Alignment, |
| 548 | context: []const u8, | 549 | context: []const u8, |
| 549 | context_alignment: std.mem.Alignment, | 550 | context_alignment: Alignment, |
| 550 | start: *const fn (context: *const anyopaque, result: *anyopaque) void, | 551 | start: *const fn (context: *const anyopaque, result: *anyopaque) void, |
| 551 | ) Io.ConcurrentError!*Io.AnyFuture { | 552 | ) Io.ConcurrentError!*Io.AnyFuture { |
| 552 | if (builtin.single_threaded) return error.ConcurrencyUnavailable; | 553 | if (builtin.single_threaded) return error.ConcurrencyUnavailable; |
| ... | @@ -591,7 +592,7 @@ const GroupClosure = struct { | ... | @@ -591,7 +592,7 @@ const GroupClosure = struct { |
| 591 | /// Points to sibling `GroupClosure`. Used for walking the group to cancel all. | 592 | /// Points to sibling `GroupClosure`. Used for walking the group to cancel all. |
| 592 | node: std.SinglyLinkedList.Node, | 593 | node: std.SinglyLinkedList.Node, |
| 593 | func: *const fn (*Io.Group, context: *anyopaque) void, | 594 | func: *const fn (*Io.Group, context: *anyopaque) void, |
| 594 | context_alignment: std.mem.Alignment, | 595 | context_alignment: Alignment, |
| 595 | alloc_len: usize, | 596 | alloc_len: usize, |
| 596 | | 597 | |
| 597 | fn start(closure: *Closure) void { | 598 | fn start(closure: *Closure) void { |
| ... | @@ -632,7 +633,7 @@ const GroupClosure = struct { | ... | @@ -632,7 +633,7 @@ const GroupClosure = struct { |
| 632 | t: *Threaded, | 633 | t: *Threaded, |
| 633 | group: *Io.Group, | 634 | group: *Io.Group, |
| 634 | context: []const u8, | 635 | context: []const u8, |
| 635 | context_alignment: std.mem.Alignment, | 636 | context_alignment: Alignment, |
| 636 | func: *const fn (*Io.Group, context: *const anyopaque) void, | 637 | func: *const fn (*Io.Group, context: *const anyopaque) void, |
| 637 | ) Allocator.Error!*GroupClosure { | 638 | ) Allocator.Error!*GroupClosure { |
| 638 | const max_context_misalignment = context_alignment.toByteUnits() -| @alignOf(GroupClosure); | 639 | const max_context_misalignment = context_alignment.toByteUnits() -| @alignOf(GroupClosure); |
| ... | @@ -671,7 +672,7 @@ fn groupAsync( | ... | @@ -671,7 +672,7 @@ fn groupAsync( |
| 671 | userdata: ?*anyopaque, | 672 | userdata: ?*anyopaque, |
| 672 | group: *Io.Group, | 673 | group: *Io.Group, |
| 673 | context: []const u8, | 674 | context: []const u8, |
| 674 | context_alignment: std.mem.Alignment, | 675 | context_alignment: Alignment, |
| 675 | start: *const fn (*Io.Group, context: *const anyopaque) void, | 676 | start: *const fn (*Io.Group, context: *const anyopaque) void, |
| 676 | ) void { | 677 | ) void { |
| 677 | const t: *Threaded = @ptrCast(@alignCast(userdata)); | 678 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| ... | @@ -790,7 +791,7 @@ fn await( | ... | @@ -790,7 +791,7 @@ fn await( |
| 790 | userdata: ?*anyopaque, | 791 | userdata: ?*anyopaque, |
| 791 | any_future: *Io.AnyFuture, | 792 | any_future: *Io.AnyFuture, |
| 792 | result: []u8, | 793 | result: []u8, |
| 793 | result_alignment: std.mem.Alignment, | 794 | result_alignment: Alignment, |
| 794 | ) void { | 795 | ) void { |
| 795 | _ = result_alignment; | 796 | _ = result_alignment; |
| 796 | const t: *Threaded = @ptrCast(@alignCast(userdata)); | 797 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |
| ... | @@ -802,7 +803,7 @@ fn cancel( | ... | @@ -802,7 +803,7 @@ fn cancel( |
| 802 | userdata: ?*anyopaque, | 803 | userdata: ?*anyopaque, |
| 803 | any_future: *Io.AnyFuture, | 804 | any_future: *Io.AnyFuture, |
| 804 | result: []u8, | 805 | result: []u8, |
| 805 | result_alignment: std.mem.Alignment, | 806 | result_alignment: Alignment, |
| 806 | ) void { | 807 | ) void { |
| 807 | _ = result_alignment; | 808 | _ = result_alignment; |
| 808 | const t: *Threaded = @ptrCast(@alignCast(userdata)); | 809 | const t: *Threaded = @ptrCast(@alignCast(userdata)); |