Esempio n. 1
0
int pthread_setschedparam_ex(pthread_t thread,
			     int policy, const struct sched_param_ex *param)
{
	pthread_t myself = pthread_self();
	struct sched_param short_param;
	unsigned long mode_offset;
	int err, promoted;

	if (thread == myself)
		xeno_fault_stack();

	err = -XENOMAI_SKINCALL5(__pse51_muxid,
				 __pse51_thread_setschedparam_ex,
				 thread, policy, param,
				 &mode_offset, &promoted);

	if (err == EPERM) {
		short_param.sched_priority = param->sched_priority;
		return __STD(pthread_setschedparam(thread, policy, &short_param));
	}

	if (!err && promoted) {
		xeno_sigshadow_install_once();
		xeno_set_current();
		xeno_set_current_mode(mode_offset);
		if (policy != SCHED_OTHER)
			XENOMAI_SYSCALL1(__xn_sys_migrate, XENOMAI_XENO_DOMAIN);
	}

	return err;
}
Esempio n. 2
0
ER shd_tsk(ID tskid, T_CTSK *pk_ctsk) /* Xenomai extension. */
{
	struct sched_param param;
	int policy, err;

	xeno_fault_stack();

	/* Make sure the POSIX library caches the right priority. */
	policy = uitron_task_set_posix_priority(pk_ctsk->itskpri, &param);
	pthread_setschedparam(pthread_self(), policy, &param);

	pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
	xeno_sigshadow_install_once();

	err = XENOMAI_SKINCALL3(__uitron_muxid,
				__uitron_cre_tsk,
				tskid, pk_ctsk,
				NULL);

	if (!err)
		xeno_set_current();

	return err;
}