mirror of
https://github.com/ziglang/zig.git
synced 2025-12-07 14:53:08 +00:00
std/Thread: remove unnecessary @ptrCast (#17766)
This commit is contained in:
parent
825da34769
commit
34aac2bae1
@ -552,7 +552,7 @@ const WindowsThreadImpl = struct {
|
|||||||
null,
|
null,
|
||||||
stack_size,
|
stack_size,
|
||||||
Instance.entryFn,
|
Instance.entryFn,
|
||||||
@as(*anyopaque, @ptrCast(instance)),
|
instance,
|
||||||
0,
|
0,
|
||||||
null,
|
null,
|
||||||
) orelse {
|
) orelse {
|
||||||
|
|||||||
@ -136,8 +136,8 @@ const WindowsImpl = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const rc = os.windows.ntdll.RtlWaitOnAddress(
|
const rc = os.windows.ntdll.RtlWaitOnAddress(
|
||||||
@as(?*const anyopaque, @ptrCast(ptr)),
|
ptr,
|
||||||
@as(?*const anyopaque, @ptrCast(&expect)),
|
&expect,
|
||||||
@sizeOf(@TypeOf(expect)),
|
@sizeOf(@TypeOf(expect)),
|
||||||
timeout_ptr,
|
timeout_ptr,
|
||||||
);
|
);
|
||||||
@ -153,7 +153,7 @@ const WindowsImpl = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn wake(ptr: *const Atomic(u32), max_waiters: u32) void {
|
fn wake(ptr: *const Atomic(u32), max_waiters: u32) void {
|
||||||
const address = @as(?*const anyopaque, @ptrCast(ptr));
|
const address: ?*const anyopaque = ptr;
|
||||||
assert(max_waiters != 0);
|
assert(max_waiters != 0);
|
||||||
|
|
||||||
switch (max_waiters) {
|
switch (max_waiters) {
|
||||||
@ -188,7 +188,7 @@ const DarwinImpl = struct {
|
|||||||
// true so that we we know to ignore the ETIMEDOUT result.
|
// true so that we we know to ignore the ETIMEDOUT result.
|
||||||
var timeout_overflowed = false;
|
var timeout_overflowed = false;
|
||||||
|
|
||||||
const addr = @as(*const anyopaque, @ptrCast(ptr));
|
const addr: *const anyopaque = ptr;
|
||||||
const flags = os.darwin.UL_COMPARE_AND_WAIT | os.darwin.ULF_NO_ERRNO;
|
const flags = os.darwin.UL_COMPARE_AND_WAIT | os.darwin.ULF_NO_ERRNO;
|
||||||
const status = blk: {
|
const status = blk: {
|
||||||
if (supports_ulock_wait2) {
|
if (supports_ulock_wait2) {
|
||||||
@ -227,7 +227,7 @@ const DarwinImpl = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const addr = @as(*const anyopaque, @ptrCast(ptr));
|
const addr: *const anyopaque = ptr;
|
||||||
const status = os.darwin.__ulock_wake(flags, addr, 0);
|
const status = os.darwin.__ulock_wake(flags, addr, 0);
|
||||||
|
|
||||||
if (status >= 0) return;
|
if (status >= 0) return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user