summaryrefslogtreecommitdiff
path: root/src/modules/test
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2010-03-24 15:40:16 +0100
committerAlexis211 <alexis211@gmail.com>2010-03-24 15:40:16 +0100
commitdbfa8cae66811247e5110e2e17f1c6ae5d1b2bcd (patch)
tree793b49a6b89c1113c74ae3ee97d197f6070cb7a7 /src/modules/test
parentcbadacbb881200b601c7b53b29aa0c1b78747692 (diff)
downloadTCE-dbfa8cae66811247e5110e2e17f1c6ae5d1b2bcd.tar.gz
TCE-dbfa8cae66811247e5110e2e17f1c6ae5d1b2bcd.zip
IPC not tested but suposedly working.
Diffstat (limited to 'src/modules/test')
-rw-r--r--src/modules/test/main.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/modules/test/main.c b/src/modules/test/main.c
index 9e03ee8..d2a4692 100644
--- a/src/modules/test/main.c
+++ b/src/modules/test/main.c
@@ -2,20 +2,36 @@
#define FACTOR 4
+int obj = -1;
+
void thread2(void* d) {
+ printk("[module:test:2] Creating new object...\n");
+ obj = object_create();
+ struct user_request rq;
while (1) {
- printk("$");
- thread_sleep(35*FACTOR);
+ printk("[module:test:2] Waiting for a request...\n");
+ request_get(obj, &rq, 1);
+ if (rq.isBlocking) {
+ printk("[module:test:2] Got request. Answering...\n");
+ request_answer(obj, 42, 0);
+ } else {
+ printk("[module:test:2] Got message. Ignoring it.\n");
+ }
}
}
int main() {
- printk("[module:test] Hi world !\n");
- printk("[module:test] Creating new thread...\n");
+ printk("[module:test:1] Hi world !\n");
+ printk("[module:test:1] Creating new thread...\n");
thread_new(thread2, 0);
- while (1) {
- printk(".");
- thread_sleep(50*FACTOR);
- }
+ while (obj == -1);
+ printk("[module:test:1] Object was created. Sending request...\n");
+ struct user_sendrequest sr;
+ sr.func = 0x80000001;
+ request(obj, &sr);
+ printk("[module:test:1] Got answer. Sending message...\n");
+ send_msg(obj, &sr);
+ printk("[module:test:1] HAHA !!! Death in 10 seconds!\n");
+ thread_sleep(10000);
return 0;
}