@@ -35,38 +35,6 @@ pjob_callback(void *data)
3535 rb_ary_push (ary , INT2FIX (counter ));
3636}
3737
38- static VALUE
39- pjob_register (VALUE self , VALUE obj )
40- {
41- counter = 0 ;
42- rb_postponed_job_register (0 , pjob_callback , (void * )obj );
43- rb_gc_start ();
44- counter ++ ;
45- rb_gc_start ();
46- counter ++ ;
47- rb_gc_start ();
48- counter ++ ;
49- return self ;
50- }
51-
52- static void
53- pjob_one_callback (void * data )
54- {
55- VALUE ary = (VALUE )data ;
56- Check_Type (ary , T_ARRAY );
57-
58- rb_ary_push (ary , INT2FIX (1 ));
59- }
60-
61- static VALUE
62- pjob_register_one (VALUE self , VALUE obj )
63- {
64- rb_postponed_job_register_one (0 , pjob_one_callback , (void * )obj );
65- rb_postponed_job_register_one (0 , pjob_one_callback , (void * )obj );
66- rb_postponed_job_register_one (0 , pjob_one_callback , (void * )obj );
67- return self ;
68- }
69-
7038static VALUE
7139pjob_call_direct (VALUE self , VALUE obj )
7240{
@@ -83,48 +51,6 @@ pjob_call_direct(VALUE self, VALUE obj)
8351
8452static void pjob_noop_callback (void * data ) { }
8553
86- static VALUE
87- pjob_register_one_same (VALUE self )
88- {
89- rb_gc_start ();
90- int r1 = rb_postponed_job_register_one (0 , pjob_noop_callback , NULL );
91- int r2 = rb_postponed_job_register_one (0 , pjob_noop_callback , NULL );
92- int r3 = rb_postponed_job_register_one (0 , pjob_noop_callback , NULL );
93- VALUE ary = rb_ary_new ();
94- rb_ary_push (ary , INT2FIX (r1 ));
95- rb_ary_push (ary , INT2FIX (r2 ));
96- rb_ary_push (ary , INT2FIX (r3 ));
97- return ary ;
98- }
99-
100- #ifdef HAVE_PTHREAD_H
101- #include <pthread.h>
102-
103- static void *
104- pjob_register_in_c_thread_i (void * obj )
105- {
106- rb_postponed_job_register_one (0 , pjob_one_callback , (void * )obj );
107- rb_postponed_job_register_one (0 , pjob_one_callback , (void * )obj );
108- rb_postponed_job_register_one (0 , pjob_one_callback , (void * )obj );
109- return NULL ;
110- }
111-
112- static VALUE
113- pjob_register_in_c_thread (VALUE self , VALUE obj )
114- {
115- pthread_t thread ;
116- if (pthread_create (& thread , NULL , pjob_register_in_c_thread_i , (void * )obj )) {
117- return Qfalse ;
118- }
119-
120- if (pthread_join (thread , NULL )) {
121- return Qfalse ;
122- }
123-
124- return Qtrue ;
125- }
126- #endif
127-
12854static void
12955pjob_preregistered_callback (void * data )
13056{
@@ -216,13 +142,7 @@ void
216142Init_postponed_job (VALUE self )
217143{
218144 VALUE mBug = rb_define_module ("Bug" );
219- rb_define_module_function (mBug , "postponed_job_register" , pjob_register , 1 );
220- rb_define_module_function (mBug , "postponed_job_register_one" , pjob_register_one , 1 );
221145 rb_define_module_function (mBug , "postponed_job_call_direct" , pjob_call_direct , 1 );
222- rb_define_module_function (mBug , "postponed_job_register_one_same" , pjob_register_one_same , 0 );
223- #ifdef HAVE_PTHREAD_H
224- rb_define_module_function (mBug , "postponed_job_register_in_c_thread" , pjob_register_in_c_thread , 1 );
225- #endif
226146 rb_define_module_function (mBug , "postponed_job_preregister_and_call_with_sleep" , pjob_preregister_and_call_with_sleep , 1 );
227147 rb_define_module_function (mBug , "postponed_job_preregister_and_call_without_sleep" , pjob_preregister_and_call_without_sleep , 1 );
228148 rb_define_module_function (mBug , "postponed_job_preregister_multiple_times" , pjob_preregister_multiple_times , 0 );
0 commit comments