Conditional schedule cleanup

This commit is contained in:
Lourens Naude 2008-10-31 15:48:28 +00:00
parent 4640893f27
commit 57712a64e6

View File

@ -1035,7 +1035,7 @@ static void schedule_query(VALUE obj, VALUE timeout)
} }
static int should_schedule_query(){ static int should_schedule_query(){
return ( ( rb_thread_main() == rb_thread_current() ) && rb_thread_alone() ); return ( ( rb_thread_main() == rb_thread_current() ) && rb_thread_alone() ) != 1;
} }
/* async_query(sql,timeout=nil) */ /* async_query(sql,timeout=nil) */
@ -1052,7 +1052,7 @@ static VALUE async_query(int argc, VALUE* argv, VALUE obj)
send_query( obj, sql ); send_query( obj, sql );
if ( should_schedule_query() != 1 ){ if ( should_schedule_query() ){
schedule_query(obj, timeout); schedule_query(obj, timeout);
} }