Skip to content

Commit 0e5a4fb

Browse files
committed
std: remove manual bindings on NetBSD
1 parent 50d5940 commit 0e5a4fb

1 file changed

Lines changed: 4 additions & 17 deletions

File tree

library/std/src/sys/pal/unix/thread_parking.rs

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,11 @@
22
// separate modules for each platform.
33
#![cfg(target_os = "netbsd")]
44

5-
use libc::{_lwp_self, CLOCK_MONOTONIC, c_long, clockid_t, lwpid_t, time_t, timespec};
5+
use libc::{_lwp_park, _lwp_self, _lwp_unpark, CLOCK_MONOTONIC, c_long, lwpid_t, time_t, timespec};
66

7-
use crate::ffi::{c_int, c_void};
87
use crate::ptr;
98
use crate::time::Duration;
109

11-
unsafe extern "C" {
12-
fn ___lwp_park60(
13-
clock_id: clockid_t,
14-
flags: c_int,
15-
ts: *mut timespec,
16-
unpark: lwpid_t,
17-
hint: *const c_void,
18-
unparkhint: *const c_void,
19-
) -> c_int;
20-
fn _lwp_unpark(lwp: lwpid_t, hint: *const c_void) -> c_int;
21-
}
22-
2310
pub type ThreadId = lwpid_t;
2411

2512
#[inline]
@@ -30,7 +17,7 @@ pub fn current() -> ThreadId {
3017
#[inline]
3118
pub fn park(hint: usize) {
3219
unsafe {
33-
___lwp_park60(0, 0, ptr::null_mut(), 0, ptr::without_provenance(hint), ptr::null());
20+
_lwp_park(0, 0, ptr::null_mut(), 0, ptr::without_provenance(hint), ptr::null_mut());
3421
}
3522
}
3623

@@ -45,13 +32,13 @@ pub fn park_timeout(dur: Duration, hint: usize) {
4532
// Timeout needs to be mutable since it is modified on NetBSD 9.0 and
4633
// above.
4734
unsafe {
48-
___lwp_park60(
35+
_lwp_park(
4936
CLOCK_MONOTONIC,
5037
0,
5138
&mut timeout,
5239
0,
5340
ptr::without_provenance(hint),
54-
ptr::null(),
41+
ptr::null_mut(),
5542
);
5643
}
5744
}

0 commit comments

Comments
 (0)