From 68136ea8dfe4662215c7bc87b4d1a809ebd981f5 Mon Sep 17 00:00:00 2001 From: Jose Narvaez Date: Wed, 11 Dec 2024 11:26:53 +0000 Subject: [PATCH] Shorter sleep in thread_sleep test. --- crates/rb-sys-tests/src/stable_api_test.rs | 2 +- crates/rb-sys/src/stable_api.rs | 3 ++- crates/rb-sys/src/stable_api/compiled.rs | 4 ++-- crates/rb-sys/src/stable_api/ruby_2_6.rs | 2 +- crates/rb-sys/src/stable_api/ruby_3_3.rs | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/rb-sys-tests/src/stable_api_test.rs b/crates/rb-sys-tests/src/stable_api_test.rs index 349c5e44..8c3156ca 100644 --- a/crates/rb-sys-tests/src/stable_api_test.rs +++ b/crates/rb-sys-tests/src/stable_api_test.rs @@ -652,6 +652,6 @@ parity_test!( name: test_rb_thread_sleep, func: thread_sleep, data_factory: { - std::time::Duration::from_secs(1) + std::time::Duration::from_millis(100) } ); diff --git a/crates/rb-sys/src/stable_api.rs b/crates/rb-sys/src/stable_api.rs index 4c7b37c2..10b34f9c 100644 --- a/crates/rb-sys/src/stable_api.rs +++ b/crates/rb-sys/src/stable_api.rs @@ -14,7 +14,8 @@ use crate::VALUE; use std::{ os::raw::{c_char, c_long}, - ptr::NonNull, time::Duration, + ptr::NonNull, + time::Duration, }; pub trait StableApiDefinition { diff --git a/crates/rb-sys/src/stable_api/compiled.rs b/crates/rb-sys/src/stable_api/compiled.rs index 5057b003..9c6c29d6 100644 --- a/crates/rb-sys/src/stable_api/compiled.rs +++ b/crates/rb-sys/src/stable_api/compiled.rs @@ -210,7 +210,7 @@ impl StableApiDefinition for Definition { tv_sec: seconds, tv_usec: microseconds, }; - + unsafe { impl_thread_sleep(time) } - } + } } diff --git a/crates/rb-sys/src/stable_api/ruby_2_6.rs b/crates/rb-sys/src/stable_api/ruby_2_6.rs index 517a433f..db39aeb2 100644 --- a/crates/rb-sys/src/stable_api/ruby_2_6.rs +++ b/crates/rb-sys/src/stable_api/ruby_2_6.rs @@ -104,7 +104,7 @@ impl StableApiDefinition for Definition { if self.special_const_p(obj) { true } else { - let rbasic = obj as *const crate::Rbasic; + let rbasic = obj as *const crate::RBasic; ((*rbasic).flags & crate::ruby_fl_type::RUBY_FL_FREEZE as VALUE) != 0 } } diff --git a/crates/rb-sys/src/stable_api/ruby_3_3.rs b/crates/rb-sys/src/stable_api/ruby_3_3.rs index bae77096..52e5a586 100644 --- a/crates/rb-sys/src/stable_api/ruby_3_3.rs +++ b/crates/rb-sys/src/stable_api/ruby_3_3.rs @@ -265,7 +265,7 @@ impl StableApiDefinition for Definition { tv_sec: seconds, tv_usec: microseconds, }; - + unsafe { crate::rb_thread_wait_for(time) } } }