Esempio n. 1
0
static apt_bool_t demo_framework_consumer_task_create(demo_framework_t *framework)
{
	apt_task_t *task;
	apt_task_vtable_t *vtable;
	apt_task_msg_pool_t *msg_pool;

	msg_pool = apt_task_msg_pool_create_dynamic(sizeof(framework_task_data_t),framework->pool);
	framework->task = apt_consumer_task_create(framework,msg_pool,framework->pool);
	if(!framework->task) {
		return FALSE;
	}
	task = apt_consumer_task_base_get(framework->task);
	apt_task_name_set(task,FRAMEWORK_TASK_NAME);
	vtable = apt_consumer_task_vtable_get(framework->task);
	if(vtable) {
		vtable->process_msg = demo_framework_msg_process;
		vtable->on_start_complete = demo_framework_on_start_complete;
	}

	return TRUE;
}
Esempio n. 2
0
bool UmcFramework::CreateTask()
{
	apt_task_t* pTask;
	apt_task_vtable_t* pVtable;
	apt_task_msg_pool_t* pMsgPool;

	pMsgPool = apt_task_msg_pool_create_dynamic(sizeof(UmcTaskMsg),m_pPool);
	m_pTask = apt_consumer_task_create(this,pMsgPool,m_pPool);
	if(!m_pTask)
		return false;

	pTask = apt_consumer_task_base_get(m_pTask);
	apt_task_name_set(pTask,"Framework Agent");
	pVtable = apt_consumer_task_vtable_get(m_pTask);
	if(pVtable) 
	{
		pVtable->process_msg = UmcProcessMsg;
		pVtable->on_start_complete = UmcOnStartComplete;
		pVtable->on_terminate_complete = UmcOnTerminateComplete;
	}

	apt_task_start(pTask);
	return true;
}