From: SASADA Koichi Date: 2007-12-07T19:10:32+09:00 Subject: Re: How to have fine grain control over GL in C extensions Hi, hemant wrote: > Well.. first I am not able to handle interupts and signals. I tried > CHECK_INTS and RUBY_VM_CHECK_INTS both and it throws undefined symbol > error. OK. I'll add a C API such as rb_thread_interrupted(void). But you don't need this API on your example. > Also, I do not think, both functions are getting executed > concurrently. Is there anything else I need to do? 2 comments: 1. Ruby is already concurrent thread. You may mean "parallel". So Ruby's thread is "ConcurrentThread". 2. It seems run in parallel. Why do you think so? > Last and final question is, how am i supposed to interupt > count_to_100000 method from stop_thr1 ? example: static void count_to_10000(void* data){ int i = 0; for( i = 0; i < 10000; i++ ) { if ((*(VALUE *)data) == Qtrue) { break; } printf("Currently Counting from thr 1: %d\n",i); } } static void stop_thr1(void* data) { printf("Calling thread1 break method\n"); *((VALUE *)data) = Qtrue; } static VALUE rb_concurrent_thread_method(VALUE self) { VALUE interrupt_flag; rb_thread_blocking_region(count_to_10000, &interrupt_flag, stop_thr1, &interrupt_flag); } -- // SASADA Koichi at atdot dot net