diff --git a/vm/os.c b/vm/os.c index cff280d..c676f59 100644 --- a/vm/os.c +++ b/vm/os.c @@ -64,8 +64,14 @@ void wasp_disable_os_loop( ){ if( -- wasp_os_loop_use ) return; wasp_disable_process( wasp_os_loop_process ); } - -void wasp_os_poll( ){ event_loop( EVLOOP_NONBLOCK | EVLOOP_ONCE ); } + +void wasp_os_poll( ){ + if( wasp_enable_count == 1 ){ + event_loop( EVLOOP_ONCE ); + }else{ + event_loop( EVLOOP_NONBLOCK | EVLOOP_ONCE ); + } +} void wasp_enable_conn_loop( wasp_os_connection oscon ){ if( oscon->looping ) return; diff --git a/vm/waspvm/process.h b/vm/waspvm/process.h index fa72a84..cef8f7d 100755 --- a/vm/waspvm/process.h +++ b/vm/waspvm/process.h @@ -76,6 +76,8 @@ extern wasp_process wasp_first_enabled; extern wasp_process wasp_last_enabled; extern wasp_process wasp_active_process; +extern wasp_quad wasp_enable_count; + #define REQ_PROCESS_ARG( x ) REQ_TYPED_ARG( x, process ) #define OPT_PROCESS_ARG( x ) OPT_TYPED_ARG( x, process ) #define PROCESS_RESULT( x ) TYPED_RESULT( process, x )