Added code for testing queues

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@317 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-04-29 14:28:37 +00:00
parent 6a199bf125
commit c5ac54877a

View file

@ -29,11 +29,14 @@ unsigned int s2[256];
void t1(void); void t1(void);
void t2(void); void t2(void);
struct event_queue main_q;
int main(void) int main(void)
{ {
char buf[40]; char buf[40];
char str[32]; char str[32];
int i=0; int i=0;
struct event *ev;
/* Clear it all! */ /* Clear it all! */
SSR1 &= ~(SCI_RDRF | SCI_ORER | SCI_PER | SCI_FER); SSR1 &= ~(SCI_RDRF | SCI_ORER | SCI_PER | SCI_FER);
@ -49,13 +52,15 @@ int main(void)
tick_start(10); tick_start(10);
queue_init(&main_q);
create_thread(t1, s1, 1024); create_thread(t1, s1, 1024);
create_thread(t2, s2, 1024); create_thread(t2, s2, 1024);
while(1) while(1)
{ {
sleep(100); ev = queue_wait(&main_q);
debugf("Thread 0 awakened\n"); debugf("Thread 0 got an event. ID: %d\n", ev->id);
} }
} }
@ -64,8 +69,10 @@ void t1(void)
debugf("Thread 1 started\n"); debugf("Thread 1 started\n");
while(1) while(1)
{ {
sleep(200); sleep(100);
debugf("Thread 1 awakened\n"); debugf("Thread 1 posting an event\n");
queue_post(&main_q, 1234, 0);
queue_post(&main_q, 5678, 0);
} }
} }