Example #1
0
static void DaoCallServer_Init( DaoVmSpace *vms )
{
	DaoCGC_Start();
	daoCallServer = DaoCallServer_New( vms );
	if( DThread_Start( & daoCallServer->timer, (DThreadTask) DaoCallServer_Timer, NULL ) ==0 ){
		dao_abort( "failed to create the timer thread" );
	}
}
Example #2
0
static void DaoCallServer_Init( DaoVmSpace *vms )
{
	DaoCGC_Start();
	daoCallServer = DaoCallServer_New( vms );
	/* Set it here, so that DaoCallServer_Stop() will not stop prematurally: */
	daoCallServer->timing = 1;
	if( DThread_Start( & daoCallServer->timer, (DThreadTask) DaoCallServer_Timer, NULL ) ==0 ){
		dao_abort( "failed to create the timer thread" );
	}
}
Example #3
0
void DaoCallServer_AddThread( DThreadTask func, void *param )
{
	DaoCallThread *calth;
	DaoCallServer_TryInit( mainVmSpace );
	calth = DaoCallThread_New( func, param );
	DMutex_Lock( & daoCallServer->mutex );
	daoCallServer->total += 1;
	DList_Append( daoCallServer->threads, calth );
	DMutex_Unlock( & daoCallServer->mutex );
	if( DThread_Start( & calth->thread, (DThreadTask) DaoCallThread_Run, calth ) == 0 ){
		if( func != NULL || daoCallServer->total == 0 ){
			dao_abort( "failed to create a task thread" );
		}
	}
}
Example #4
0
void DaoVmSpace_AddTaskletThread( DaoVmSpace *self, DThreadTask func, void *param, void *proc )
{
	DaoTaskletThread *taskthd;
	DaoTaskletServer *server = DaoTaskletServer_TryInit( self );
	taskthd = DaoTaskletThread_New( server, func, param );
	taskthd->taskOwner = proc;
	DMutex_Lock( & server->mutex );
	server->total += 1;
	DList_Append( server->threads, taskthd );
	DMutex_Unlock( & server->mutex );
	if( DThread_Start( & taskthd->thread, (DThreadTask) DaoTaskletThread_Run, taskthd ) == 0 ){
		if( func != NULL || server->total == 0 ){
			dao_abort( "failed to create a task thread" );
		}
	}
}
Example #5
0
static void DaoTaskletServer_Init( DaoVmSpace *vms )
{
	DaoTaskletServer *server;

	DaoCGC_Start();

	if( vms->taskletServer ) return;

	server = DaoTaskletServer_New( vms );
	/* Set it here, so that DaoVmSpace_StopTasklets() will not stop prematurally: */
	server->timing = 1;
	if( DThread_Start( & server->timer, (DThreadTask) DaoTaskletServer_Timer, server ) ==0 ){
		dao_abort( "failed to create the timer thread" );
	}
	vms->taskletServer = server;
}