sdk/linux_kernel_drivers/xocl/xocl_exec.c
/**
 * init_scheduler_thread() - Initialize scheduler thread if necessary
 *
 * Return: 0 on success, -errno otherwise
 */
Initialize scheduler thread if necessary
Return: 0 on success, -errno otherwise
Initialize scheduler thread if necessary Return : 0 on success - errno otherwise
static int
init_scheduler_thread(void)
{
#ifdef SCHED_THREAD_ENABLE
	SCHED_DEBUGF("init_scheduler_thread use_count=%d\n",global_scheduler0.use_count);
	if (global_scheduler0.use_count++)
		return 0;
	init_waitqueue_head(&global_scheduler0.wait_queue);
	global_scheduler0.error = 0;
	INIT_LIST_HEAD(&global_scheduler0.command_queue);
	atomic_set(&global_scheduler0.intc,0);
	atomic_set(&global_scheduler0.poll,0);
	global_scheduler0.scheduler_thread = kthread_run(scheduler,(void*)&global_scheduler0,"xocl-scheduler-thread0");
	if (IS_ERR(global_scheduler0.scheduler_thread)) {
		int ret = PTR_ERR(global_scheduler0.scheduler_thread);
		DRM_ERROR(__func__);
		return ret;
	}
#endif
	return 0;
}
static int init_scheduler_thread ( void ) { #ifdef SCHED_THREAD_ENABLE SCHED_DEBUGF ( " \n " , global_scheduler0 . use_count ) ; if ( global_scheduler0 . use_count ++ ) return 0 ; init_waitqueue_head ( & global_scheduler0 . wait_queue ) ; global_scheduler0 . error = 0 ; INIT_LIST_HEAD ( & global_scheduler0 . command_queue ) ; atomic_set ( & global_scheduler0 . intc , 0 ) ; atomic_set ( & global_scheduler0 . poll , 0 ) ; global_scheduler0 . scheduler_thread = kthread_run ( scheduler , ( void * ) & global_scheduler0 , " " ) ; if ( IS_ERR ( global_scheduler0 . scheduler_thread ) ) { int ret = PTR_ERR ( global_scheduler0 . scheduler_thread ) ; DRM_ERROR ( __func__ ) ; return ret ; } #endif return 0 ; }
init_scheduler_thread() - Initialize scheduler thread if necessary
 Return: 0 on success, -errno otherwise
init_scheduler_thread () - Initialize scheduler thread if necessary Return : 0 on success - errno otherwise