aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-07-10 12:04:27 +0200
committerGitHub <noreply@github.com>2025-07-10 12:04:27 +0200
commit1a998886c863a1829d649f196093f1058cd9cf13 (patch)
treedb1b3b0a043a113cfb6544e8103cb64f8e4e4d8f /lib/std/Thread.zig
parent5b4b033236a7bed19c90faf7fefbc1990911cfef (diff)
parent10d6db5d7d1fb62ee2915a7ad2c7feb771ea3bbb (diff)
downloadzig-1a998886c863a1829d649f196093f1058cd9cf13.tar.gz
zig-1a998886c863a1829d649f196093f1058cd9cf13.zip
Merge pull request #24329 from ziglang/writergate
Deprecates all existing std.io readers and writers in favor of the newly provided std.io.Reader and std.io.Writer which are non-generic and have the buffer above the vtable - in other words the buffer is in the interface, not the implementation. This means that although Reader and Writer are no longer generic, they are still transparent to optimization; all of the interface functions have a concrete hot path operating on the buffer, and only make vtable calls when the buffer is full.
Diffstat (limited to 'lib/std/Thread.zig')
-rw-r--r--lib/std/Thread.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig
index bb46bd3f24..fd2111da71 100644
--- a/lib/std/Thread.zig
+++ b/lib/std/Thread.zig
@@ -167,7 +167,7 @@ pub fn setName(self: Thread, name: []const u8) SetNameError!void {
const file = try std.fs.cwd().openFile(path, .{ .mode = .write_only });
defer file.close();
- try file.writer().writeAll(name);
+ try file.deprecatedWriter().writeAll(name);
return;
},
.windows => {
@@ -281,7 +281,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co
const file = try std.fs.cwd().openFile(path, .{});
defer file.close();
- const data_len = try file.reader().readAll(buffer_ptr[0 .. max_name_len + 1]);
+ const data_len = try file.deprecatedReader().readAll(buffer_ptr[0 .. max_name_len + 1]);
return if (data_len >= 1) buffer[0 .. data_len - 1] else null;
},
@@ -1163,7 +1163,7 @@ const LinuxThreadImpl = struct {
fn getCurrentId() Id {
return tls_thread_id orelse {
- const tid = @as(u32, @bitCast(linux.gettid()));
+ const tid: u32 = @bitCast(linux.gettid());
tls_thread_id = tid;
return tid;
};