lib/sched: add evl_yield() for manual round-robin

An equivalent of sched_yield().

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
This commit is contained in:
Philippe Gerum 2020-04-22 11:11:39 +02:00
parent c8b3bb1cca
commit 55bb9159aa
4 changed files with 13 additions and 1 deletions

View File

@ -20,7 +20,7 @@
#include <evl/poll.h>
#include <evl/proxy.h>
#define __EVL__ 12 /* API version */
#define __EVL__ 13 /* API version */
#define EVL_ABI_PREREQ 21

View File

@ -26,6 +26,8 @@ int evl_control_sched(int policy,
int evl_get_cpustate(int cpu, int *state_r);
int evl_yield(void);
#ifdef __cplusplus
}
#endif

View File

@ -71,3 +71,12 @@ int evl_get_cpustate(int cpu, int *state_r)
return 0;
}
int evl_yield(void)
{
if (evl_current == EVL_NO_HANDLE)
return -EPERM;
/* This is our sched_yield(). */
return oob_ioctl(evl_efd, EVL_THRIOC_YIELD) ? -errno : 0;
}

View File

@ -22,6 +22,7 @@ int main(int argc, char *argv[])
param.quota.op = evl_quota_add;
evl_control_sched(SCHED_QUOTA, &param, &info, 0);
evl_get_cpustate(0, &cpu_state);
evl_yield();
return 0;
}