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:
parent
c8b3bb1cca
commit
55bb9159aa
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ int main(int argc, char *argv[])
|
|||
param.quota.op = evl_quota_add;
|
||||
evl_control_sched(SCHED_QUOTA, ¶m, &info, 0);
|
||||
evl_get_cpustate(0, &cpu_state);
|
||||
evl_yield();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue