Hi
I'm trying to implement data structure in scheduler, but when I initialize it in:
chschd.c
void _scheduler_init(void) {
ch.rlist.dl = (systime_t)50;
}
I get big number in:
thread_t *chSchReadyI(thread_t *tp) {
cp = (thread_t *)&ch.rlist.queue;
cp->dl //-> this is not 50
}
chschd.h
struct ch_thread{[/b]
systime_t dl;
}
struct ch_ready_list{
systime_t dl;
}
I thing that problem is in allocate memory but I don't find out issue.
When I try:
chschd.c
void _scheduler_init(void) {
thread_t *cp;
queue_init(&ch.rlist.queue);
ch.rlist.prio = 0;
ch.rlist.dl = (systime_t)50;
cp = (thread_t *)&ch.rlist.queue;
cp->dl -> this is 0 and not 50.
}
thread data structure
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: thread data structure
I can only point out that the first fields of the thread structure and ready list structure must be the same because list handling, apparently this is not the case in your modification.
Giovanni
Giovanni
Re: thread data structure
Hi,
When i copied lines in structures (thread, ready list), it solved my problem. Can you explain it to me ? I thought that in c it does no matter how is structure written. Is it because I cast it in pointer of thread like: cp = (thread_t *)&ch.rlist.queue;
Thank you
Khan
When i copied lines in structures (thread, ready list), it solved my problem. Can you explain it to me ? I thought that in c it does no matter how is structure written. Is it because I cast it in pointer of thread like: cp = (thread_t *)&ch.rlist.queue;
Thank you
Khan
Re: thread data structure
Hi
What is difference between preempt and time in thread data structure ?
Khan.
What is difference between preempt and time in thread data structure ?
Khan.
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: thread data structure
Preempt is the number of ticks until next round robin event, time is the time consumed by the thread in ticks.
Giovanni
Giovanni
Who is online
Users browsing this forum: No registered users and 4 guests