コード例 #1
0
ファイル: threads.c プロジェクト: spriteray/libevlite
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 );
}
コード例 #2
0
ファイル: threads.c プロジェクト: shenyanjun/libevlite
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 );
}