Ejemplo n.º 1
0
int32_t iothread_post( struct iothread * self, int16_t type, int16_t utype, void * task, uint8_t size )
{
    struct task inter_task = { .type=type, .utype=utype };
    struct iothreads * threads = (struct iothreads *)self->parent;

    if ( size == 0 )
    {
        inter_task.taskdata = task;
    }
    else
    {
        memcpy( &(inter_task.data), task, size );
    }

    // 默认: 提交任务不提醒消费者
    return msgqueue_push( self->queue, &inter_task, threads->immediately );
}
Ejemplo n.º 2
0
int32_t iothread_post( struct iothread * self, int16_t type, int16_t utype, void * task, uint8_t size )
{
	struct task intask;

	intask.type		= type;
	intask.utype	= utype;
	if ( size > 0 )
	{
		memcpy( &(intask.data), task, size );
	}
	else
	{
		intask.task = task;
	}

	// 默认: 提交任务不提醒消费者
	return msgqueue_push( self->queue, &intask, POST_IOTASK_AND_NOTIFY );
}