pf2 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/ext/pf2/src/lib.rs +2 -0
- data/ext/pf2/src/ruby_internal_apis.rs +9 -2
- data/ext/pf2/src/session.rs +19 -4
- data/ext/pf2/src/signal_scheduler_unsupported_platform.rs +39 -0
- data/lib/pf2/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29a7c92a2a313dec57af9a3427cd723224f64bf53cf74a488253741e1098c12d
|
4
|
+
data.tar.gz: 4958d188fdddec9fb8143a1b864e9c40d989bbb3360745eb0846687cefc97b9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a2a7ecd0a4cb0d84f022c3ec1e0844e2c537cfad88f91b0051609006d8c2f4d596f15a1fd259709c97c1ffccbae87e96758a4bcfb70293d88fb44d7888f4071
|
7
|
+
data.tar.gz: 28b108cd63c75d7ead6f34fdd88fdaa867a9601a0217899b024176a4e5508ef9dec7395bf7ae77513de6eb4cc765be90e010146bdd114b989b33359e4ac55068
|
data/CHANGELOG.md
CHANGED
data/ext/pf2/src/lib.rs
CHANGED
@@ -1,13 +1,20 @@
|
|
1
1
|
#![allow(non_snake_case)]
|
2
2
|
#![allow(non_camel_case_types)]
|
3
3
|
|
4
|
-
use libc::{clockid_t,
|
4
|
+
use libc::{clockid_t, pthread_t};
|
5
5
|
use rb_sys::{rb_check_typeddata, rb_data_type_struct, RTypedData, VALUE};
|
6
6
|
use std::ffi::{c_char, c_int, c_void};
|
7
7
|
use std::mem::MaybeUninit;
|
8
8
|
|
9
|
-
|
9
|
+
#[cfg(target_os = "linux")]
|
10
|
+
use libc::pthread_getcpuclockid;
|
11
|
+
|
12
|
+
#[cfg(not(target_os = "linux"))]
|
13
|
+
pub unsafe fn pthread_getcpuclockid(thread: pthread_t, clk_id: *mut clockid_t) -> c_int {
|
14
|
+
unimplemented!()
|
15
|
+
}
|
10
16
|
|
17
|
+
// Types and structs from Ruby 3.4.0.
|
11
18
|
#[repr(C)]
|
12
19
|
pub struct rb_callable_method_entry_struct {
|
13
20
|
/* same fields with rb_method_entry_t */
|
data/ext/pf2/src/session.rs
CHANGED
@@ -16,7 +16,10 @@ use self::configuration::Configuration;
|
|
16
16
|
use self::new_thread_watcher::NewThreadWatcher;
|
17
17
|
use crate::profile::Profile;
|
18
18
|
use crate::scheduler::Scheduler;
|
19
|
+
#[cfg(target_os = "linux")]
|
19
20
|
use crate::signal_scheduler::SignalScheduler;
|
21
|
+
#[cfg(not(target_os = "linux"))]
|
22
|
+
use crate::signal_scheduler_unsupported_platform::SignalScheduler;
|
20
23
|
use crate::timer_thread_scheduler::TimerThreadScheduler;
|
21
24
|
use crate::util::*;
|
22
25
|
|
@@ -176,15 +179,27 @@ impl Session {
|
|
176
179
|
let ptr = rb_string_value_ptr(&mut str);
|
177
180
|
CStr::from_ptr(ptr).to_str().unwrap()
|
178
181
|
};
|
179
|
-
|
180
|
-
|
182
|
+
let scheduler =
|
183
|
+
configuration::Scheduler::from_str(specified_scheduler).unwrap_or_else(|_| {
|
184
|
+
// Raise an ArgumentError if the mode is invalid
|
185
|
+
unsafe {
|
186
|
+
rb_raise(
|
187
|
+
rb_eArgError,
|
188
|
+
cstr!("Invalid scheduler. Valid values are ':signal' and ':timer_thread'."),
|
189
|
+
)
|
190
|
+
}
|
191
|
+
});
|
192
|
+
|
193
|
+
// Raise an ArgumentError if the scheduler is not supported on the current platform
|
194
|
+
if !cfg!(target_os = "linux") && scheduler == configuration::Scheduler::Signal {
|
181
195
|
unsafe {
|
182
196
|
rb_raise(
|
183
197
|
rb_eArgError,
|
184
|
-
cstr!("
|
198
|
+
cstr!("Signal scheduler is not supported on this platform."),
|
185
199
|
)
|
186
200
|
}
|
187
|
-
}
|
201
|
+
}
|
202
|
+
scheduler
|
188
203
|
}
|
189
204
|
|
190
205
|
pub fn start(&mut self) -> VALUE {
|
@@ -0,0 +1,39 @@
|
|
1
|
+
use std::sync::{Arc, RwLock};
|
2
|
+
|
3
|
+
use crate::profile::Profile;
|
4
|
+
use crate::scheduler::Scheduler;
|
5
|
+
use crate::session::configuration::Configuration;
|
6
|
+
|
7
|
+
pub struct SignalScheduler {}
|
8
|
+
|
9
|
+
impl Scheduler for SignalScheduler {
|
10
|
+
fn start(&self) -> rb_sys::VALUE {
|
11
|
+
unimplemented!()
|
12
|
+
}
|
13
|
+
|
14
|
+
fn stop(&self) -> rb_sys::VALUE {
|
15
|
+
unimplemented!()
|
16
|
+
}
|
17
|
+
|
18
|
+
fn on_new_thread(&self, thread: rb_sys::VALUE) {
|
19
|
+
unimplemented!()
|
20
|
+
}
|
21
|
+
|
22
|
+
fn dmark(&self) {
|
23
|
+
unimplemented!()
|
24
|
+
}
|
25
|
+
|
26
|
+
fn dfree(&self) {
|
27
|
+
unimplemented!()
|
28
|
+
}
|
29
|
+
|
30
|
+
fn dsize(&self) -> rb_sys::size_t {
|
31
|
+
unimplemented!()
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
impl SignalScheduler {
|
36
|
+
pub fn new(configuration: &Configuration, profile: Arc<RwLock<Profile>>) -> Self {
|
37
|
+
unimplemented!()
|
38
|
+
}
|
39
|
+
}
|
data/lib/pf2/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pf2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daisuke Aritomo
|
@@ -177,6 +177,7 @@ files:
|
|
177
177
|
- ext/pf2/src/session/ruby_object.rs
|
178
178
|
- ext/pf2/src/siginfo_t.c
|
179
179
|
- ext/pf2/src/signal_scheduler.rs
|
180
|
+
- ext/pf2/src/signal_scheduler_unsupported_platform.rs
|
180
181
|
- ext/pf2/src/timer_thread_scheduler.rs
|
181
182
|
- ext/pf2/src/util.rs
|
182
183
|
- lib/pf2.rb
|