Issue #4770 has been updated by Motohiro KOSAKI.

File 0001-interrupt-flag.patch added
Category set to core
Status changed from Open to Assigned
Assignee set to Motohiro KOSAKI
Target version set to 1.9.3


----------------------------------------
Bug #4770:  [Q] thread->interrupt_flag  ???????????篁???九勝??????????????????????????????
http://redmine.ruby-lang.org/issues/4770

Author: Motohiro KOSAKI
Status: Assigned
Priority: Normal
Assignee: Motohiro KOSAKI
Category: core
Target version: 1.9.3
ruby -v: -


 kosaki??с??
 
 Ruby VM internal
 ??荅????????鴻????莖????с?????????thread->interrupt_flag??????????c???篁???九勝??????????????吟?ゃ?潟???c?????障????с???????????鐚?
 
 ?????????障??????
 
 鐚?鐚?????????????鴻??????篏??c?????????ф??篁???九勝??????????????違?????鴻???????????????篋????????????
 
 #define RUBY_VM_SET_INTERRUPT(th) ((th)->interrupt_flag |= 0x02)
 #define RUBY_VM_SET_TIMER_INTERRUPT(th) ((th)->interrupt_flag |= 0x01)
 #define RUBY_VM_SET_FINALIZER_INTERRUPT(th) ((th)->interrupt_flag |= 0x04)
 #define RUBY_VM_INTERRUPTED(th) ((th)->interrupt_flag & 0x02)
 
 鐚?鐚?蚊??莨若?水?????с?????違?????祉???????????膊??????с??GVL?????????c????
 
 static void
 rb_threadptr_execute_interrupts_rec(rb_thread_t *th, int sched_depth)
 {
 (snip)
 
     while (th->interrupt_flag) {
         enum rb_thread_status status = th->status;
         int timer_interrupt = th->interrupt_flag & 0x01;
         int finalizer_interrupt = th->interrupt_flag & 0x04;
         th->interrupt_flag = 0;
 
 鐚?鐚?帥?ゃ????若?鴻?????????TIMER_INTERRUPT bit???腴????????????timer_thread_lock ???????????c????
 
 static void
 timer_thread_function(void *arg)
 {
     rb_vm_t *vm = GET_VM(); /* TODO: fix me for Multi-VM */
 
     /* for time slice */
     RUBY_VM_SET_TIMER_INTERRUPT(vm->running_thread);
 
 鐚?鐚?thread.c ??с?? RUBY_VM_SET_INTERRUPT??若?吟?????? thread->interrupt_lock ?????????
 cont.c ??с??????????
 
 鐚?鐚?gc.c??? RUBY_VM_SET_FINALIZER_INTERRUPT ??若?吟??????鴻??????????????????
 
 ????????????????????翫????с???????????????????????倶??????c????????????????????с??????????荀???純?????????障????с???????????鐚?
 
 鐚? 筝??????????鴻?? interrupt_lock??у?????????????????????????????c?????с?????????????????????? native_mutex_lock()??∽?違??
 鐚? thread.c 篁ュ???????????若?鴻??????с????????


-- 
http://redmine.ruby-lang.org