source: CIVL/text/include/sched.cvl@ 4540352

1.23 2.0 main test-branch
Last change on this file since 4540352 was e182ee04, checked in by John Edenhofner <johneden@…>, 12 years ago

Added basic scheduling header, modified pthread_mutex_lock as well as mutliple other methods

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

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