Bug #9972 ยป 0001-Suppress-warnings-printf-format-lx-of-VALUE.patch
ext/tk/tcltklib.c | ||
---|---|---|
#endif
|
||
#endif
|
||
DUMP2("eventloop_sleep: rb_thread_wait_for() at thread : %lx", rb_thread_current());
|
||
DUMP2("eventloop_sleep: rb_thread_wait_for() at thread : %p", (void *)rb_thread_current());
|
||
rb_thread_wait_for(t);
|
||
DUMP2("eventloop_sleep: finish at thread : %lx", rb_thread_current());
|
||
DUMP2("eventloop_sleep: finish at thread : %p", (void *)rb_thread_current());
|
||
#ifdef HAVE_NATIVETHREAD
|
||
#ifndef RUBY_USE_NATIVE_THREAD
|
||
... | ... | |
}
|
||
} else {
|
||
DUMP2("sleep eventloop %lx", current);
|
||
DUMP2("eventloop thread is %lx", eventloop_thread);
|
||
DUMP2("sleep eventloop %p", (void *)current);
|
||
DUMP2("eventloop thread is %p", (void *)eventloop_thread);
|
||
/* rb_thread_stop(); */
|
||
rb_thread_sleep_forever();
|
||
}
|
||
... | ... | |
Tcl_DeleteEventSource(rbtk_EventSetupProc, rbtk_EventCheckProc, (ClientData)args);
|
||
DUMP2("eventloop_ensure: current-thread : %lx", current_evloop);
|
||
DUMP2("eventloop_ensure: eventloop-thread : %lx", eventloop_thread);
|
||
DUMP2("eventloop_ensure: current-thread : %p", (void *)current_evloop);
|
||
DUMP2("eventloop_ensure: eventloop-thread : %p", (void *)eventloop_thread);
|
||
if (eventloop_thread != current_evloop) {
|
||
DUMP2("finish eventloop %lx (NOT current eventloop)", current_evloop);
|
||
DUMP2("finish eventloop %p (NOT current eventloop)", (void *)current_evloop);
|
||
rb_thread_critical = ptr->thr_crit_bup;
|
||
... | ... | |
}
|
||
while((eventloop_thread = rb_ary_pop(eventloop_stack))) {
|
||
DUMP2("eventloop-ensure: new eventloop-thread -> %lx",
|
||
eventloop_thread);
|
||
DUMP2("eventloop-ensure: new eventloop-thread -> %p",
|
||
(void *)eventloop_thread);
|
||
if (eventloop_thread == current_evloop) {
|
||
rbtk_eventloop_depth--;
|
||
DUMP2("eventloop %lx : back from recursive call", current_evloop);
|
||
DUMP2("eventloop %p : back from recursive call", (void *)current_evloop);
|
||
break;
|
||
}
|
||
... | ... | |
}
|
||
if (RTEST(rb_thread_alive_p(eventloop_thread))) {
|
||
DUMP2("eventloop-enshure: wake up parent %lx", eventloop_thread);
|
||
DUMP2("eventloop-enshure: wake up parent %p", (void *)eventloop_thread);
|
||
rb_thread_wakeup(eventloop_thread);
|
||
break;
|
||
... | ... | |
xfree(ptr);
|
||
/* ckfree((char*)ptr);*/
|
||
DUMP2("finish current eventloop %lx", current_evloop);
|
||
DUMP2("finish current eventloop %p", (void *)current_evloop);
|
||
return Qnil;
|
||
}
|
||
... | ... | |
#endif
|
||
if (parent_evloop == eventloop_thread) {
|
||
DUMP2("eventloop: recursive call on %lx", parent_evloop);
|
||
DUMP2("eventloop: recursive call on %p", (void *)parent_evloop);
|
||
rbtk_eventloop_depth++;
|
||
}
|
||
if (!NIL_P(parent_evloop) && parent_evloop != eventloop_thread) {
|
||
DUMP2("wait for stop of parent_evloop %lx", parent_evloop);
|
||
DUMP2("wait for stop of parent_evloop %p", (void *)parent_evloop);
|
||
while(!RTEST(rb_funcall(parent_evloop, ID_stop_p, 0))) {
|
||
DUMP2("parent_evloop %lx doesn't stop", parent_evloop);
|
||
DUMP2("parent_evloop %p doesn't stop", (void *)parent_evloop);
|
||
rb_thread_run(parent_evloop);
|
||
}
|
||
DUMP1("succeed to stop parent");
|
||
... | ... | |
rb_ary_push(eventloop_stack, parent_evloop);
|
||
DUMP3("tcltklib: eventloop-thread : %lx -> %lx\n",
|
||
parent_evloop, eventloop_thread);
|
||
DUMP3("tcltklib: eventloop-thread : %p -> %p\n",
|
||
(void *)parent_evloop, (void *)eventloop_thread);
|
||
args->check_root = check_root;
|
||
args->update_flag = update_flag;
|
||
... | ... | |
if (NIL_P(eventloop_thread)
|
||
|| (loop_counter == prev_val && chance >= EVLOOP_WAKEUP_CHANCE)) {
|
||
/* start new eventloop thread */
|
||
DUMP2("eventloop thread %lx is sleeping or dead",
|
||
eventloop_thread);
|
||
DUMP2("eventloop thread %p is sleeping or dead",
|
||
(void *)eventloop_thread);
|
||
evloop = rb_thread_create(watchdog_evloop_launcher,
|
||
(void*)&check_rootwidget);
|
||
DUMP2("create new eventloop thread %lx", evloop);
|
||
DUMP2("create new eventloop thread %p", (void *)evloop);
|
||
loop_counter = -1;
|
||
chance = 0;
|
||
rb_thread_run(evloop);
|
||
... | ... | |
thr_crit_bup = rb_thread_critical;
|
||
rb_thread_critical = Qfalse;
|
||
ret = rb_apply(arg->receiver, arg->method, arg->args);
|
||
DUMP2("rb_apply return:%lx", ret);
|
||
DUMP2("rb_apply return:%p", (void *)ret);
|
||
rb_thread_critical = thr_crit_bup;
|
||
DUMP1("finish ip_ruby_cmd_core");
|
||
... | ... | |
if (rb_thread_alone() || eventloop_thread == current_thread) {
|
||
#if TCL_MAJOR_VERSION >= 8
|
||
DUMP1("call ip_rbTkWaitObjCmd");
|
||
DUMP2("eventloop_thread %lx", eventloop_thread);
|
||
DUMP2("current_thread %lx", current_thread);
|
||
DUMP2("eventloop_thread %p", (void *)eventloop_thread);
|
||
DUMP2("current_thread %p", (void *)current_thread);
|
||
return ip_rbTkWaitObjCmd(clientData, interp, objc, objv);
|
||
#else /* TCL_MAJOR_VERSION < 8 */
|
||
DUMP1("call rb_VwaitCommand");
|
||
... | ... | |
{
|
||
int thr_crit_bup;
|
||
DUMP2("free Tcl Interp %lx", (unsigned long)ptr->ip);
|
||
DUMP2("free Tcl Interp %p", ptr->ip);
|
||
if (ptr) {
|
||
thr_crit_bup = rb_thread_critical;
|
||
rb_thread_critical = Qtrue;
|
||
... | ... | |
&& !Tcl_InterpDeleted(ptr->ip)
|
||
&& Tcl_GetMaster(ptr->ip) != (Tcl_Interp*)NULL
|
||
&& !Tcl_InterpDeleted(Tcl_GetMaster(ptr->ip)) ) {
|
||
DUMP2("parent IP(%lx) is not deleted",
|
||
(unsigned long)Tcl_GetMaster(ptr->ip));
|
||
DUMP2("slave IP(%lx) should not be deleted",
|
||
(unsigned long)ptr->ip);
|
||
DUMP2("parent IP(%p) is not deleted",
|
||
Tcl_GetMaster(ptr->ip));
|
||
DUMP2("slave IP(%p) should not be deleted",
|
||
ptr->ip);
|
||
xfree(ptr);
|
||
/* ckfree((char*)ptr); */
|
||
rb_thread_critical = thr_crit_bup;
|
||
... | ... | |
struct tcltkip *ptr;
|
||
DUMP2("do_call_queue_handler : evPtr = %p", evPtr);
|
||
DUMP2("call_queue_handler thread : %lx", rb_thread_current());
|
||
DUMP2("added by thread : %lx", thread);
|
||
DUMP2("call_queue_handler thread : %p", (void *)rb_thread_current());
|
||
DUMP2("added by thread : %p", (void *)thread);
|
||
if (*(q->done)) {
|
||
DUMP1("processed by another event-loop");
|
||
... | ... | |
rb_gc_force_recycle(q_dat);
|
||
q_dat = (VALUE)NULL;
|
||
} else {
|
||
DUMP2("call function (for caller thread:%lx)", thread);
|
||
DUMP2("call function (current thread:%lx)", rb_thread_current());
|
||
DUMP2("call function (for caller thread:%p)", (void *)thread);
|
||
DUMP2("call function (current thread:%p)", (void *)rb_thread_current());
|
||
ret = (q->func)(q->interp, q->argc, q->argv);
|
||
}
|
||
... | ... | |
/* back to caller */
|
||
if (RTEST(rb_thread_alive_p(thread))) {
|
||
DUMP2("back to caller (caller thread:%lx)", thread);
|
||
DUMP2(" (current thread:%lx)", rb_thread_current());
|
||
DUMP2("back to caller (caller thread:%p)", (void *)thread);
|
||
DUMP2(" (current thread:%p)", (void *)rb_thread_current());
|
||
#if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE
|
||
have_rb_thread_waiting_for_value = 1;
|
||
rb_thread_wakeup(thread);
|
||
... | ... | |
rb_thread_schedule();
|
||
#endif
|
||
} else {
|
||
DUMP2("caller is dead (caller thread:%lx)", thread);
|
||
DUMP2(" (current thread:%lx)", rb_thread_current());
|
||
DUMP2("caller is dead (caller thread:%p)", (void *)thread);
|
||
DUMP2(" (current thread:%p)", (void *)rb_thread_current());
|
||
}
|
||
/* end of handler : remove it */
|
||
... | ... | |
&& (NIL_P(eventloop_thread) || current == eventloop_thread)
|
||
) {
|
||
if (NIL_P(eventloop_thread)) {
|
||
DUMP2("tk_funcall from thread:%lx but no eventloop", current);
|
||
DUMP2("tk_funcall from thread:%p but no eventloop", (void *)current);
|
||
} else {
|
||
DUMP2("tk_funcall from current eventloop %lx", current);
|
||
DUMP2("tk_funcall from current eventloop %p", (void *)current);
|
||
}
|
||
result = (func)(ip_obj, argc, argv);
|
||
if (rb_obj_is_kind_of(result, rb_eException)) {
|
||
... | ... | |
return result;
|
||
}
|
||
DUMP2("tk_funcall from thread %lx (NOT current eventloop)", current);
|
||
DUMP2("tk_funcall from thread %p (NOT current eventloop)", (void *)current);
|
||
thr_crit_bup = rb_thread_critical;
|
||
rb_thread_critical = Qtrue;
|
||
... | ... | |
t.tv_sec = 0;
|
||
t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0);
|
||
DUMP2("callq wait for handler (current thread:%lx)", current);
|
||
DUMP2("callq wait for handler (current thread:%p)", (void *)current);
|
||
while(*alloc_done >= 0) {
|
||
DUMP2("*** callq wait for handler (current thread:%lx)", current);
|
||
DUMP2("*** callq wait for handler (current thread:%p)", (void *)current);
|
||
/* rb_thread_stop(); */
|
||
/* rb_thread_sleep_forever(); */
|
||
rb_thread_wait_for(t);
|
||
DUMP2("*** callq wakeup (current thread:%lx)", current);
|
||
DUMP2("*** (eventloop thread:%lx)", eventloop_thread);
|
||
DUMP2("*** callq wakeup (current thread:%p)", (void *)current);
|
||
DUMP2("*** (eventloop thread:%p)", (void *)eventloop_thread);
|
||
if (NIL_P(eventloop_thread)) {
|
||
DUMP1("*** callq lost eventloop thread");
|
||
break;
|
||
}
|
||
}
|
||
DUMP2("back from handler (current thread:%lx)", current);
|
||
DUMP2("back from handler (current thread:%p)", (void *)current);
|
||
/* get result & free allocated memory */
|
||
ret = RARRAY_PTR(result)[0];
|
||
... | ... | |
struct tcltkip *ptr;
|
||
DUMP2("do_eval_queue_handler : evPtr = %p", evPtr);
|
||
DUMP2("eval_queue_thread : %lx", rb_thread_current());
|
||
DUMP2("added by thread : %lx", thread);
|
||
DUMP2("eval_queue_thread : %p", (void *)rb_thread_current());
|
||
DUMP2("added by thread : %p", (void *)thread);
|
||
if (*(q->done)) {
|
||
DUMP1("processed by another event-loop");
|
||
... | ... | |
/* back to caller */
|
||
if (RTEST(rb_thread_alive_p(thread))) {
|
||
DUMP2("back to caller (caller thread:%lx)", thread);
|
||
DUMP2(" (current thread:%lx)", rb_thread_current());
|
||
DUMP2("back to caller (caller thread:%p)", (void *)thread);
|
||
DUMP2(" (current thread:%p)", (void *)rb_thread_current());
|
||
#if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE
|
||
have_rb_thread_waiting_for_value = 1;
|
||
rb_thread_wakeup(thread);
|
||
... | ... | |
rb_thread_schedule();
|
||
#endif
|
||
} else {
|
||
DUMP2("caller is dead (caller thread:%lx)", thread);
|
||
DUMP2(" (current thread:%lx)", rb_thread_current());
|
||
DUMP2("caller is dead (caller thread:%p)", (void *)thread);
|
||
DUMP2(" (current thread:%p)", (void *)rb_thread_current());
|
||
}
|
||
/* end of handler : remove it */
|
||
... | ... | |
#else
|
||
DUMP2("status: Tcl_GetCurrentThread %p", Tcl_GetCurrentThread());
|
||
#endif
|
||
DUMP2("status: eventloopt_thread %lx", eventloop_thread);
|
||
DUMP2("status: eventloopt_thread %p", (void *)eventloop_thread);
|
||
if (
|
||
#ifdef RUBY_USE_NATIVE_THREAD
|
||
... | ... | |
(NIL_P(eventloop_thread) || current == eventloop_thread)
|
||
) {
|
||
if (NIL_P(eventloop_thread)) {
|
||
DUMP2("eval from thread:%lx but no eventloop", current);
|
||
DUMP2("eval from thread:%p but no eventloop", (void *)current);
|
||
} else {
|
||
DUMP2("eval from current eventloop %lx", current);
|
||
DUMP2("eval from current eventloop %p", (void *)current);
|
||
}
|
||
result = ip_eval_real(self, RSTRING_PTR(str), RSTRING_LENINT(str));
|
||
if (rb_obj_is_kind_of(result, rb_eException)) {
|
||
... | ... | |
return result;
|
||
}
|
||
DUMP2("eval from thread %lx (NOT current eventloop)", current);
|
||
DUMP2("eval from thread %p (NOT current eventloop)", (void *)current);
|
||
thr_crit_bup = rb_thread_critical;
|
||
rb_thread_critical = Qtrue;
|
||
... | ... | |
t.tv_sec = 0;
|
||
t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0);
|
||
DUMP2("evq wait for handler (current thread:%lx)", current);
|
||
DUMP2("evq wait for handler (current thread:%p)", (void *)current);
|
||
while(*alloc_done >= 0) {
|
||
DUMP2("*** evq wait for handler (current thread:%lx)", current);
|
||
DUMP2("*** evq wait for handler (current thread:%p)", (void *)current);
|
||
/* rb_thread_stop(); */
|
||
/* rb_thread_sleep_forever(); */
|
||
rb_thread_wait_for(t);
|
||
DUMP2("*** evq wakeup (current thread:%lx)", current);
|
||
DUMP2("*** (eventloop thread:%lx)", eventloop_thread);
|
||
DUMP2("*** evq wakeup (current thread:%p)", (void *)current);
|
||
DUMP2("*** (eventloop thread:%p)", (void *)eventloop_thread);
|
||
if (NIL_P(eventloop_thread)) {
|
||
DUMP1("*** evq lost eventloop thread");
|
||
break;
|
||
}
|
||
}
|
||
DUMP2("back from handler (current thread:%lx)", current);
|
||
DUMP2("back from handler (current thread:%p)", (void *)current);
|
||
/* get result & free allocated memory */
|
||
ret = RARRAY_PTR(result)[0];
|
||
... | ... | |
char **av = (char **)NULL;
|
||
#endif
|
||
DUMP2("invoke_real called by thread:%lx", rb_thread_current());
|
||
DUMP2("invoke_real called by thread:%p", (void *)rb_thread_current());
|
||
/* get the data struct */
|
||
ptr = get_ip(interp);
|
||
... | ... | |
struct tcltkip *ptr;
|
||
DUMP2("do_invoke_queue_handler : evPtr = %p", evPtr);
|
||
DUMP2("invoke queue_thread : %lx", rb_thread_current());
|
||
DUMP2("added by thread : %lx", thread);
|
||
DUMP2("invoke queue_thread : %p", (void *)rb_thread_current());
|
||
DUMP2("added by thread : %p", (void *)thread);
|
||
if (*(q->done)) {
|
||
DUMP1("processed by another event-loop");
|
||
... | ... | |
rb_gc_force_recycle(q_dat);
|
||
q_dat = (VALUE)NULL;
|
||
} else {
|
||
DUMP2("call invoke_real (for caller thread:%lx)", thread);
|
||
DUMP2("call invoke_real (current thread:%lx)", rb_thread_current());
|
||
DUMP2("call invoke_real (for caller thread:%p)", (void *)thread);
|
||
DUMP2("call invoke_real (current thread:%p)", (void *)rb_thread_current());
|
||
ret = ip_invoke_core(q->interp, q->argc, q->argv);
|
||
}
|
||
... | ... | |
/* back to caller */
|
||
if (RTEST(rb_thread_alive_p(thread))) {
|
||
DUMP2("back to caller (caller thread:%lx)", thread);
|
||
DUMP2(" (current thread:%lx)", rb_thread_current());
|
||
DUMP2("back to caller (caller thread:%p)", (void *)thread);
|
||
DUMP2(" (current thread:%p)", (void *)rb_thread_current());
|
||
#if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE
|
||
have_rb_thread_waiting_for_value = 1;
|
||
rb_thread_wakeup(thread);
|
||
... | ... | |
rb_thread_schedule();
|
||
#endif
|
||
} else {
|
||
DUMP2("caller is dead (caller thread:%lx)", thread);
|
||
DUMP2(" (current thread:%lx)", rb_thread_current());
|
||
DUMP2("caller is dead (caller thread:%p)", (void *)thread);
|
||
DUMP2(" (current thread:%p)", (void *)rb_thread_current());
|
||
}
|
||
/* end of handler : remove it */
|
||
... | ... | |
#else
|
||
DUMP2("status: Tcl_GetCurrentThread %p", Tcl_GetCurrentThread());
|
||
#endif
|
||
DUMP2("status: eventloopt_thread %lx", eventloop_thread);
|
||
DUMP2("status: eventloopt_thread %p", (void *)eventloop_thread);
|
||
if (
|
||
#ifdef RUBY_USE_NATIVE_THREAD
|
||
... | ... | |
(NIL_P(eventloop_thread) || current == eventloop_thread)
|
||
) {
|
||
if (NIL_P(eventloop_thread)) {
|
||
DUMP2("invoke from thread:%lx but no eventloop", current);
|
||
DUMP2("invoke from thread:%p but no eventloop", (void *)current);
|
||
} else {
|
||
DUMP2("invoke from current eventloop %lx", current);
|
||
DUMP2("invoke from current eventloop %p", (void *)current);
|
||
}
|
||
result = ip_invoke_real(argc, argv, ip_obj);
|
||
if (rb_obj_is_kind_of(result, rb_eException)) {
|
||
... | ... | |
return result;
|
||
}
|
||
DUMP2("invoke from thread %lx (NOT current eventloop)", current);
|
||
DUMP2("invoke from thread %p (NOT current eventloop)", (void *)current);
|
||
thr_crit_bup = rb_thread_critical;
|
||
rb_thread_critical = Qtrue;
|
||
... | ... | |
t.tv_sec = 0;
|
||
t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0);
|
||
DUMP2("ivq wait for handler (current thread:%lx)", current);
|
||
DUMP2("ivq wait for handler (current thread:%p)", (void *)current);
|
||
while(*alloc_done >= 0) {
|
||
/* rb_thread_stop(); */
|
||
/* rb_thread_sleep_forever(); */
|
||
rb_thread_wait_for(t);
|
||
DUMP2("*** ivq wakeup (current thread:%lx)", current);
|
||
DUMP2("*** (eventloop thread:%lx)", eventloop_thread);
|
||
DUMP2("*** ivq wakeup (current thread:%p)", (void *)current);
|
||
DUMP2("*** (eventloop thread:%p)", (void *)eventloop_thread);
|
||
if (NIL_P(eventloop_thread)) {
|
||
DUMP1("*** ivq lost eventloop thread");
|
||
break;
|
||
}
|
||
}
|
||
DUMP2("back from handler (current thread:%lx)", current);
|
||
DUMP2("back from handler (current thread:%p)", (void *)current);
|
||
/* get result & free allocated memory */
|
||
ret = RARRAY_PTR(result)[0];
|