1.23
2.0
main
test-branch
| Line | |
|---|
| 1 | #include <pthread.h>
|
|---|
| 2 | enum{
|
|---|
| 3 | SCHED_FIFO,
|
|---|
| 4 | SCHED_RR,
|
|---|
| 5 | SCHED_SPORADIC,
|
|---|
| 6 | SCHED_OTHER
|
|---|
| 7 | };
|
|---|
| 8 |
|
|---|
| 9 | typedef $proc pid_t;
|
|---|
| 10 |
|
|---|
| 11 | typedef struct{
|
|---|
| 12 | int sched_priority;
|
|---|
| 13 | } sched_param;
|
|---|
| 14 | /*
|
|---|
| 15 | int 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 |
|
|---|
| 37 | int 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 |
|
|---|
| 57 | int 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 |
|
|---|
| 66 | int 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 |
|
|---|
| 78 | int 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.