summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-04-29 14:28:37 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-04-29 14:28:37 +0000
commitc5ac54877a4ce9ca3ed1b059776ce3c99678d6ea (patch)
tree10121ea1c8fc7d5955bde295174c40397af71800
parent6a199bf125f4e5018d8172bcaf8b645a6c411bfc (diff)
Added code for testing queues
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@317 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/test/kernel/main.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/firmware/test/kernel/main.c b/firmware/test/kernel/main.c
index 1280b8113b..fe7ddc8378 100644
--- a/firmware/test/kernel/main.c
+++ b/firmware/test/kernel/main.c
@@ -29,11 +29,14 @@ unsigned int s2[256];
void t1(void);
void t2(void);
+struct event_queue main_q;
+
int main(void)
{
char buf[40];
char str[32];
int i=0;
+ struct event *ev;
/* Clear it all! */
SSR1 &= ~(SCI_RDRF | SCI_ORER | SCI_PER | SCI_FER);
@@ -49,13 +52,15 @@ int main(void)
tick_start(10);
+ queue_init(&main_q);
+
create_thread(t1, s1, 1024);
create_thread(t2, s2, 1024);
while(1)
{
- sleep(100);
- debugf("Thread 0 awakened\n");
+ ev = queue_wait(&main_q);
+ debugf("Thread 0 got an event. ID: %d\n", ev->id);
}
}
@@ -64,8 +69,10 @@ void t1(void)
debugf("Thread 1 started\n");
while(1)
{
- sleep(200);
- debugf("Thread 1 awakened\n");
+ sleep(100);
+ debugf("Thread 1 posting an event\n");
+ queue_post(&main_q, 1234, 0);
+ queue_post(&main_q, 5678, 0);
}
}