aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread.zig
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/Thread.zig')
-rw-r--r--lib/std/Thread.zig36
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig
index e2ee51e1dc..f16f8a9a79 100644
--- a/lib/std/Thread.zig
+++ b/lib/std/Thread.zig
@@ -65,8 +65,8 @@ pub fn setName(self: Thread, name: []const u8) SetNameError!void {
.linux => if (use_pthreads) {
if (self.getHandle() == std.c.pthread_self()) {
// Set the name of the calling thread (no thread id required).
- const err = try os.prctl(.SET_NAME, .{@ptrToInt(name_with_terminator.ptr)});
- switch (@intToEnum(os.E, err)) {
+ const err = try os.prctl(.SET_NAME, .{@intFromPtr(name_with_terminator.ptr)});
+ switch (@enumFromInt(os.E, err)) {
.SUCCESS => return,
else => |e| return os.unexpectedErrno(e),
}
@@ -175,8 +175,8 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co
.linux => if (use_pthreads) {
if (self.getHandle() == std.c.pthread_self()) {
// Get the name of the calling thread (no thread id required).
- const err = try os.prctl(.GET_NAME, .{@ptrToInt(buffer.ptr)});
- switch (@intToEnum(os.E, err)) {
+ const err = try os.prctl(.GET_NAME, .{@intFromPtr(buffer.ptr)});
+ switch (@enumFromInt(os.E, err)) {
.SUCCESS => return std.mem.sliceTo(buffer, 0),
else => |e| return os.unexpectedErrno(e),
}
@@ -611,7 +611,7 @@ const PosixThreadImpl = struct {
return @bitCast(u32, c.find_thread(null));
},
else => {
- return @ptrToInt(c.pthread_self());
+ return @intFromPtr(c.pthread_self());
},
}
}
@@ -776,7 +776,7 @@ const LinuxThreadImpl = struct {
\\ movl $0, %%ebx
\\ int $128
:
- : [ptr] "r" (@ptrToInt(self.mapped.ptr)),
+ : [ptr] "r" (@intFromPtr(self.mapped.ptr)),
[len] "r" (self.mapped.len),
: "memory"
),
@@ -787,7 +787,7 @@ const LinuxThreadImpl = struct {
\\ movq $1, %%rdi
\\ syscall
:
- : [ptr] "{rdi}" (@ptrToInt(self.mapped.ptr)),
+ : [ptr] "{rdi}" (@intFromPtr(self.mapped.ptr)),
[len] "{rsi}" (self.mapped.len),
),
.arm, .armeb, .thumb, .thumbeb => asm volatile (
@@ -799,7 +799,7 @@ const LinuxThreadImpl = struct {
\\ mov r0, #0
\\ svc 0
:
- : [ptr] "r" (@ptrToInt(self.mapped.ptr)),
+ : [ptr] "r" (@intFromPtr(self.mapped.ptr)),
[len] "r" (self.mapped.len),
: "memory"
),
@@ -812,7 +812,7 @@ const LinuxThreadImpl = struct {
\\ mov x0, #0
\\ svc 0
:
- : [ptr] "r" (@ptrToInt(self.mapped.ptr)),
+ : [ptr] "r" (@intFromPtr(self.mapped.ptr)),
[len] "r" (self.mapped.len),
: "memory"
),
@@ -826,7 +826,7 @@ const LinuxThreadImpl = struct {
\\ li $4, 0
\\ syscall
:
- : [ptr] "r" (@ptrToInt(self.mapped.ptr)),
+ : [ptr] "r" (@intFromPtr(self.mapped.ptr)),
[len] "r" (self.mapped.len),
: "memory"
),
@@ -839,7 +839,7 @@ const LinuxThreadImpl = struct {
\\ li $4, 0
\\ syscall
:
- : [ptr] "r" (@ptrToInt(self.mapped.ptr)),
+ : [ptr] "r" (@intFromPtr(self.mapped.ptr)),
[len] "r" (self.mapped.len),
: "memory"
),
@@ -853,7 +853,7 @@ const LinuxThreadImpl = struct {
\\ sc
\\ blr
:
- : [ptr] "r" (@ptrToInt(self.mapped.ptr)),
+ : [ptr] "r" (@intFromPtr(self.mapped.ptr)),
[len] "r" (self.mapped.len),
: "memory"
),
@@ -866,7 +866,7 @@ const LinuxThreadImpl = struct {
\\ mv a0, zero
\\ ecall
:
- : [ptr] "r" (@ptrToInt(self.mapped.ptr)),
+ : [ptr] "r" (@intFromPtr(self.mapped.ptr)),
[len] "r" (self.mapped.len),
: "memory"
),
@@ -893,7 +893,7 @@ const LinuxThreadImpl = struct {
\\ mov 1, %%o0
\\ t 0x6d
:
- : [ptr] "r" (@ptrToInt(self.mapped.ptr)),
+ : [ptr] "r" (@intFromPtr(self.mapped.ptr)),
[len] "r" (self.mapped.len),
: "memory"
),
@@ -911,7 +911,7 @@ const LinuxThreadImpl = struct {
thread: ThreadCompletion,
fn entryFn(raw_arg: usize) callconv(.C) u8 {
- const self = @intToPtr(*@This(), raw_arg);
+ const self = @ptrFromInt(*@This(), raw_arg);
defer switch (self.thread.completion.swap(.completed, .SeqCst)) {
.running => {},
.completed => unreachable,
@@ -980,7 +980,7 @@ const LinuxThreadImpl = struct {
var tls_ptr = os.linux.tls.prepareTLS(mapped[tls_offset..]);
var user_desc: if (target.cpu.arch == .x86) os.linux.user_desc else void = undefined;
if (target.cpu.arch == .x86) {
- defer tls_ptr = @ptrToInt(&user_desc);
+ defer tls_ptr = @intFromPtr(&user_desc);
user_desc = .{
.entry_number = os.linux.tls.tls_image.gdt_entry_number,
.base_addr = tls_ptr,
@@ -1007,9 +1007,9 @@ const LinuxThreadImpl = struct {
switch (linux.getErrno(linux.clone(
Instance.entryFn,
- @ptrToInt(&mapped[stack_offset]),
+ @intFromPtr(&mapped[stack_offset]),
flags,
- @ptrToInt(instance),
+ @intFromPtr(instance),
&instance.thread.parent_tid,
tls_ptr,
&instance.thread.child_tid.value,