do not derive Copy for timespec
This commit is contained in:
@@ -5,7 +5,7 @@ use crate::{
|
||||
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/time.h.html>.
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Default, Debug)]
|
||||
#[derive(Clone, Default, Debug)]
|
||||
pub struct timespec {
|
||||
pub tv_sec: time_t,
|
||||
pub tv_nsec: c_long,
|
||||
|
||||
@@ -76,7 +76,7 @@ pub unsafe extern "C" fn pthread_mutex_timedlock(
|
||||
mutex: *mut pthread_mutex_t,
|
||||
abstime: ×pec,
|
||||
) -> c_int {
|
||||
let relative = match timespec_realtime_to_monotonic(*abstime) {
|
||||
let relative = match timespec_realtime_to_monotonic(abstime.clone()) {
|
||||
Ok(relative) => relative,
|
||||
Err(err) => return e(Err(err)),
|
||||
};
|
||||
|
||||
@@ -96,7 +96,7 @@ pub unsafe extern "C" fn sem_clockwait(
|
||||
clock_id: clockid_t,
|
||||
abstime: *const timespec,
|
||||
) -> c_int {
|
||||
if let Ok(()) = unsafe { get(sem) }.wait(Some(&unsafe { *abstime }), clock_id) {}; // TODO handle error
|
||||
if let Ok(()) = unsafe { get(sem) }.wait(Some(&unsafe { (*abstime).clone() }), clock_id) {}; // TODO handle error
|
||||
|
||||
0
|
||||
}
|
||||
@@ -104,7 +104,8 @@ pub unsafe extern "C" fn sem_clockwait(
|
||||
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/sem_timedwait.html>.
|
||||
#[unsafe(no_mangle)]
|
||||
pub unsafe extern "C" fn sem_timedwait(sem: *mut sem_t, abstime: *const timespec) -> c_int {
|
||||
if let Ok(()) = unsafe { get(sem) }.wait(Some(&unsafe { *abstime }), CLOCK_REALTIME) {}; // TODO handle error
|
||||
if let Ok(()) = unsafe { get(sem) }.wait(Some(&unsafe { (*abstime).clone() }), CLOCK_REALTIME) {
|
||||
}; // TODO handle error
|
||||
|
||||
0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user