ext/pf2/src/ruby_init.rs in pf2-0.4.0 vs ext/pf2/src/ruby_init.rs in pf2-0.5.0
- old
+ new
@@ -1,12 +1,10 @@
#![deny(unsafe_op_in_unsafe_fn)]
use rb_sys::*;
-#[cfg(target_os = "linux")]
-use crate::signal_scheduler::SignalScheduler;
-use crate::timer_thread_scheduler::TimerThreadScheduler;
+use crate::session::ruby_object::SessionRubyObject;
use crate::util::*;
#[allow(non_snake_case)]
#[no_mangle]
extern "C" fn Init_pf2() {
@@ -19,56 +17,27 @@
}
unsafe {
let rb_mPf2: VALUE = rb_define_module(cstr!("Pf2"));
- #[cfg(target_os = "linux")]
- {
- let rb_mPf2_SignalScheduler =
- rb_define_class_under(rb_mPf2, cstr!("SignalScheduler"), rb_cObject);
- rb_define_alloc_func(rb_mPf2_SignalScheduler, Some(SignalScheduler::rb_alloc));
- rb_define_method(
- rb_mPf2_SignalScheduler,
- cstr!("initialize"),
- Some(to_ruby_cfunc_with_args(SignalScheduler::rb_initialize)),
- -1,
- );
- rb_define_method(
- rb_mPf2_SignalScheduler,
- cstr!("start"),
- Some(to_ruby_cfunc_with_no_args(SignalScheduler::rb_start)),
- 0,
- );
- rb_define_method(
- rb_mPf2_SignalScheduler,
- cstr!("stop"),
- Some(to_ruby_cfunc_with_no_args(SignalScheduler::rb_stop)),
- 0,
- );
- }
-
- let rb_mPf2_TimerThreadScheduler =
- rb_define_class_under(rb_mPf2, cstr!("TimerThreadScheduler"), rb_cObject);
- rb_define_alloc_func(
- rb_mPf2_TimerThreadScheduler,
- Some(TimerThreadScheduler::rb_alloc),
- );
+ let rb_mPf2_Session = rb_define_class_under(rb_mPf2, cstr!("Session"), rb_cObject);
+ rb_define_alloc_func(rb_mPf2_Session, Some(SessionRubyObject::rb_alloc));
rb_define_method(
- rb_mPf2_TimerThreadScheduler,
+ rb_mPf2_Session,
cstr!("initialize"),
- Some(to_ruby_cfunc_with_args(TimerThreadScheduler::rb_initialize)),
+ Some(to_ruby_cfunc_with_args(SessionRubyObject::rb_initialize)),
-1,
);
rb_define_method(
- rb_mPf2_TimerThreadScheduler,
+ rb_mPf2_Session,
cstr!("start"),
- Some(to_ruby_cfunc_with_no_args(TimerThreadScheduler::rb_start)),
+ Some(to_ruby_cfunc_with_no_args(SessionRubyObject::rb_start)),
0,
);
rb_define_method(
- rb_mPf2_TimerThreadScheduler,
+ rb_mPf2_Session,
cstr!("stop"),
- Some(to_ruby_cfunc_with_no_args(TimerThreadScheduler::rb_stop)),
+ Some(to_ruby_cfunc_with_no_args(SessionRubyObject::rb_stop)),
0,
);
}
}