static void FUTURE_Wait( DaoProcess *proc, DaoValue *par[], int N ) { DaoFuture *self = (DaoFuture*) par[0]; float timeout = par[1]->xFloat.value; DaoProcess_PutBoolean( proc, self->state == DAO_CALL_FINISHED ); if( self->state == DAO_CALL_FINISHED || timeout == 0 ) return; proc->status = DAO_PROCESS_SUSPENDED; proc->pauseType = DAO_PAUSE_FUTURE_WAIT; DaoCallServer_AddWait( proc, self, timeout ); }
static void FUTURE_Value( DaoProcess *proc, DaoValue *par[], int N ) { DaoFuture *self = (DaoFuture*) par[0]; if( self->state == DAO_CALL_FINISHED ){ DaoProcess_PutValue( proc, self->value ); return; } proc->status = DAO_PROCESS_SUSPENDED; proc->pauseType = DAO_PAUSE_FUTURE_VALUE; DaoCallServer_AddWait( proc, self, -1 ); }
static void FUTURE_Wait( DaoProcess *proc, DaoValue *par[], int N ) { DaoFuture *self = (DaoFuture*) par[0]; float timeout = par[1]->xFloat.value; DaoProcess_PutInteger( proc, self->state == DAO_CALL_FINISHED ); if( DaoProcess_CheckCB( proc, "cannot block inside code section method" ) ) return; if( self->state == DAO_CALL_FINISHED || timeout == 0 ) return; proc->status = DAO_PROCESS_SUSPENDED; proc->pauseType = DAO_PAUSE_FUTURE_WAIT; DaoCallServer_AddWait( proc, self, timeout ); }
static void FUTURE_Value( DaoProcess *proc, DaoValue *par[], int N ) { DaoFuture *self = (DaoFuture*) par[0]; if( self->state == DAO_CALL_FINISHED ){ DaoProcess_PutValue( proc, self->value ); return; } if( DaoProcess_CheckCB( proc, "cannot block inside code section method" ) ) return; proc->status = DAO_PROCESS_SUSPENDED; proc->pauseType = DAO_PAUSE_FUTURE_VALUE; DaoCallServer_AddWait( proc, self, -1 ); }
static void FUTURE_Wait( DaoProcess *proc, DaoValue *par[], int N ) { DaoFuture *self = (DaoFuture*) par[0]; float timeout = par[1]->xFloat.value; DaoProcess_PutBoolean( proc, self->state == DAO_CALL_FINISHED ); if( self->state == DAO_CALL_FINISHED || timeout == 0 ) return; #ifdef DAO_WITH_CONCURRENT proc->status = DAO_PROCESS_SUSPENDED; proc->pauseType = DAO_PAUSE_FUTURE_WAIT; DaoCallServer_AddWait( proc, self, timeout ); #else DaoProcess_RaiseError( proc, NULL, "Invalid future value" ); #endif }
static void FUTURE_Value( DaoProcess *proc, DaoValue *par[], int N ) { DaoFuture *self = (DaoFuture*) par[0]; if( self->state == DAO_CALL_FINISHED ){ DaoProcess_PutValue( proc, self->value ); return; } #ifdef DAO_WITH_CONCURRENT proc->status = DAO_PROCESS_SUSPENDED; proc->pauseType = DAO_PAUSE_FUTURE_VALUE; DaoCallServer_AddWait( proc, self, -1 ); #else DaoProcess_RaiseError( proc, NULL, "Invalid future value" ); #endif }