| ... | @@ -1758,9 +1758,7 @@ test "open file with exclusive and shared nonblocking lock" { | ... | @@ -1758,9 +1758,7 @@ test "open file with exclusive and shared nonblocking lock" { |
| 1758 | } | 1758 | } |
| 1759 | | 1759 | |
| 1760 | test "open file with exclusive lock twice, make sure second lock waits" { | 1760 | test "open file with exclusive lock twice, make sure second lock waits" { |
| 1761 | if (builtin.single_threaded) return error.SkipZigTest; | 1761 | testWithAllSupportedPathTypes(struct { |
| 1762 | | | |
| 1763 | try testWithAllSupportedPathTypes(struct { | | |
| 1764 | fn impl(ctx: *TestContext) !void { | 1762 | fn impl(ctx: *TestContext) !void { |
| 1765 | const io = ctx.io; | 1763 | const io = ctx.io; |
| 1766 | const filename = try ctx.transformPath("file_lock_test.txt"); | 1764 | const filename = try ctx.transformPath("file_lock_test.txt"); |
| ... | @@ -1781,8 +1779,8 @@ test "open file with exclusive lock twice, make sure second lock waits" { | ... | @@ -1781,8 +1779,8 @@ test "open file with exclusive lock twice, make sure second lock waits" { |
| 1781 | var started: Io.Event = .unset; | 1779 | var started: Io.Event = .unset; |
| 1782 | var locked: Io.Event = .unset; | 1780 | var locked: Io.Event = .unset; |
| 1783 | | 1781 | |
| 1784 | const t = try std.Thread.spawn(.{}, S.checkFn, .{ ctx, filename, &started, &locked }); | 1782 | var t = try io.concurrent(S.checkFn, .{ ctx, filename, &started, &locked }); |
| 1785 | defer t.join(); | 1783 | defer t.cancel(io) catch {}; |
| 1786 | | 1784 | |
| 1787 | // Wait for the spawned thread to start trying to acquire the exclusive file lock. | 1785 | // Wait for the spawned thread to start trying to acquire the exclusive file lock. |
| 1788 | // Then wait a bit to make sure that can't acquire it since we currently hold the file lock. | 1786 | // Then wait a bit to make sure that can't acquire it since we currently hold the file lock. |
| ... | @@ -1795,8 +1793,12 @@ test "open file with exclusive lock twice, make sure second lock waits" { | ... | @@ -1795,8 +1793,12 @@ test "open file with exclusive lock twice, make sure second lock waits" { |
| 1795 | // Release the file lock which should unlock the thread to lock it and set the locked event. | 1793 | // Release the file lock which should unlock the thread to lock it and set the locked event. |
| 1796 | file.close(io); | 1794 | file.close(io); |
| 1797 | try locked.wait(io); | 1795 | try locked.wait(io); |
| | 1796 | try t.await(io); |
| 1798 | } | 1797 | } |
| 1799 | }.impl); | 1798 | }.impl) catch |err| switch (err) { |
| | 1799 | error.ConcurrencyUnavailable => return error.SkipZigTest, |
| | 1800 | else => |e| return e, |
| | 1801 | }; |
| 1800 | } | 1802 | } |
| 1801 | | 1803 | |
| 1802 | test "open file with exclusive nonblocking lock twice (absolute paths)" { | 1804 | test "open file with exclusive nonblocking lock twice (absolute paths)" { |