source: CIVL/include/impls/sched.cvl@ 1aaefd4

main test-branch
Last change on this file since 1aaefd4 was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago

Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.1 KB
Line 
1#ifndef __SCHED__
2#define __SCHED__
3
4#include <pthread.h>
5enum{
6 SCHED_FIFO,
7 SCHED_RR,
8 SCHED_SPORADIC,
9 SCHED_OTHER
10};
11
12typedef $proc pid_t;
13
14typedef struct{
15 int sched_priority;
16} sched_param;
17/*
18int sched_get_priority_max(int policy)
19{
20 if(policy == SCHED_FIFO || policy == SCHED_RR)
21 {
22 return 31;
23 }
24 else
25 {
26 return 0;
27 }
28}
29
30int sched_get_priority_min(int policy){
31 return 0;
32}
33
34int sched_getparam(pid_t pid, struct sched_param *param)
35{
36 for(int i = 0; i < _pool.len-1; i++){
37 if(pid == _pool.threads[i]->thr){
38 *param = *(_pool.threads[i}->attr->param);
39 }
40 return 0;
41}
42
43int sched_setscheduler(pid_t pid, int policy, const sched_param *param)
44{
45 for(int i = 0; i < _pool.len-1; i++){
46 if(pid == _pool.threads[i]->thr){
47 *(_pool.threads[i}->attr.param) = *param;
48 *(_pool.threads[i}->attr.schedpolicy) = policy;
49 return 0;
50 }
51 }
52 return ERSCH;
53}
54
55int sched_getscheduler(pid_t pid)
56{
57 if(pid == $proc_null){
58 }
59 for(int i = 0; i < _pool.len-1; i++){
60 if(pid == _pool.threads[i]->thr){
61 return _pool.threads[i]->attr.schedpolicy;
62 }
63 }
64}
65
66*/
67
68#endif
Note: See TracBrowser for help on using the repository browser.