Renamed thread/team syscalls to new scheme.
Minor cleanups. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6887 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
/*
|
||||
** Copyright 2003-2004, The OpenBeOS Team. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <syscalls.h>
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int i, rc;
|
||||
team_id pid;
|
||||
@@ -21,18 +28,18 @@ int main(int argc, char **argv)
|
||||
printf("setenv() error\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
printf("Getting VAR_1: ");
|
||||
var = getenv("VAR_1");
|
||||
if (var)
|
||||
printf("found set to: \"%s\"\n", var);
|
||||
else
|
||||
printf("not found\n");
|
||||
|
||||
|
||||
printf("List of env variables set:\n");
|
||||
for (i=0; environ[i]; i++)
|
||||
for (i = 0; environ[i]; i++)
|
||||
printf("%s\n", environ[i]);
|
||||
|
||||
|
||||
if (argc > 1) {
|
||||
char buffer[16];
|
||||
char *_argv[] = { argv[0], buffer, NULL };
|
||||
@@ -47,8 +54,8 @@ int main(int argc, char **argv)
|
||||
if (val > 0) {
|
||||
printf("Spawning test (%d left)\n", val);
|
||||
sprintf(buffer, "%d", val);
|
||||
pid = sys_create_team(_argv[0], _argv[0], _argv, 2, NULL, 0, 5);
|
||||
sys_wait_on_team(pid, &rc);
|
||||
pid = _kern_create_team(_argv[0], _argv[0], _argv, 2, NULL, 0, 5);
|
||||
_kern_wait_for_team(pid, &rc);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
+23
-20
@@ -3,34 +3,37 @@
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <syscalls.h>
|
||||
|
||||
|
||||
static
|
||||
void
|
||||
usage(char const *app)
|
||||
{
|
||||
printf("usage: %s [-s] ###\n", app);
|
||||
sys_exit(-1);
|
||||
_kern_exit(-1);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int num= 0;
|
||||
int silent= 0;
|
||||
int num = 0;
|
||||
int silent = 0;
|
||||
int result;
|
||||
|
||||
switch(argc) {
|
||||
|
||||
switch (argc) {
|
||||
case 2:
|
||||
num= atoi(argv[1]);
|
||||
num = atoi(argv[1]);
|
||||
break;
|
||||
case 3:
|
||||
if(strcmp(argv[1], "-s")== 0) {
|
||||
num= atoi(argv[2]);
|
||||
silent= 1;
|
||||
if (strcmp(argv[1], "-s") == 0) {
|
||||
num = atoi(argv[2]);
|
||||
silent = 1;
|
||||
} else {
|
||||
usage(argv[0]);
|
||||
}
|
||||
@@ -40,27 +43,27 @@ main(int argc, char *argv[])
|
||||
break;
|
||||
}
|
||||
|
||||
if(num < 2) {
|
||||
result= 1;
|
||||
if (num < 2) {
|
||||
result = 1;
|
||||
} else {
|
||||
team_id pid;
|
||||
int retcode;
|
||||
char buffer[64];
|
||||
char *aaargv[]= { "/boot/bin/fibo", "-s", buffer, NULL };
|
||||
int aaargc= 3;
|
||||
char *aaargv[] = { "/boot/bin/fibo", "-s", buffer, NULL };
|
||||
int aaargc = 3;
|
||||
|
||||
sprintf(buffer, "%d", num-1);
|
||||
pid= sys_create_team(aaargv[0], aaargv[0], aaargv, aaargc, NULL, 0, 5);
|
||||
sys_wait_on_team(pid, &retcode);
|
||||
result= retcode;
|
||||
pid = _kern_create_team(aaargv[0], aaargv[0], aaargv, aaargc, NULL, 0, 5);
|
||||
_kern_wait_for_team(pid, &retcode);
|
||||
result = retcode;
|
||||
|
||||
sprintf(buffer, "%d", num-2);
|
||||
pid= sys_create_team(aaargv[0], aaargv[0], aaargv, aaargc, NULL, 0, 5);
|
||||
sys_wait_on_team(pid, &retcode);
|
||||
result+= retcode;
|
||||
pid = _kern_create_team(aaargv[0], aaargv[0], aaargv, aaargc, NULL, 0, 5);
|
||||
_kern_wait_for_team(pid, &retcode);
|
||||
result += retcode;
|
||||
}
|
||||
|
||||
if(silent) {
|
||||
if (silent) {
|
||||
return result;
|
||||
} else {
|
||||
printf("%d\n", result);
|
||||
|
||||
@@ -26,40 +26,38 @@ main(void)
|
||||
}
|
||||
|
||||
rc = fstat(fd, &stat);
|
||||
if(rc < 0) {
|
||||
if (rc < 0) {
|
||||
printf("Cookie monster was here!!!\n");
|
||||
sys_exit(1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
buf= malloc(stat.st_size + 1);
|
||||
buf = malloc(stat.st_size + 1);
|
||||
|
||||
read(fd, buf, stat.st_size);
|
||||
buf[stat.st_size]= 0;
|
||||
buf[stat.st_size] = 0;
|
||||
close(fd);
|
||||
|
||||
found= 0;
|
||||
for(i= 0; i< stat.st_size; i++) {
|
||||
if(strncmp(buf+i, "#@#", 3)== 0) {
|
||||
found+= 1;
|
||||
}
|
||||
found = 0;
|
||||
for (i = 0; i < stat.st_size; i++) {
|
||||
if (!strncmp(buf + i, "#@#", 3))
|
||||
found += 1;
|
||||
}
|
||||
|
||||
found = 1 + (sys_system_time() % found);
|
||||
found = 1 + (system_time() % found);
|
||||
|
||||
for(i = 0; i < stat.st_size; i++) {
|
||||
if(strncmp(buf+i, "#@#", 3)== 0) {
|
||||
found-= 1;
|
||||
}
|
||||
if(found== 0) {
|
||||
for (i = 0; i < stat.st_size; i++) {
|
||||
if (!strncmp(buf + i, "#@#", 3))
|
||||
found -= 1;
|
||||
|
||||
if (found == 0) {
|
||||
unsigned j;
|
||||
|
||||
for(j= i+1; j< stat.st_size; j++) {
|
||||
if(strncmp(buf+j, "#@#", 3)== 0) {
|
||||
buf[j]= 0;
|
||||
}
|
||||
for (j = i + 1; j < stat.st_size; j++) {
|
||||
if (!strncmp(buf + j, "#@#", 3))
|
||||
buf[j] = 0;
|
||||
}
|
||||
|
||||
printf("%s\n", buf+i+3);
|
||||
printf("%s\n", buf + i + 3);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+18
-19
@@ -2,59 +2,58 @@
|
||||
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <syscalls.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
static void setup_io()
|
||||
|
||||
static void
|
||||
setup_io(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i= 0; i< 256; i++) {
|
||||
for (i = 0; i< 256; i++) {
|
||||
close(i);
|
||||
}
|
||||
|
||||
/* XXX - open currently ignores these flags, but they
|
||||
* should be checked once it doesn't :)
|
||||
* Is STDERR really O_WRONLY?
|
||||
*/
|
||||
open("/dev/console", O_RDONLY, 0); /* stdin */
|
||||
open("/dev/console", O_WRONLY, 0); /* stdout */
|
||||
open("/dev/console", O_WRONLY, 0); /* stderr */
|
||||
}
|
||||
|
||||
int main()
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
setup_io();
|
||||
|
||||
printf("Welcome to OpenBeOS!\n");
|
||||
|
||||
if(1) {
|
||||
{
|
||||
team_id pid;
|
||||
|
||||
pid = sys_create_team("/boot/bin/fortune", "/boot/bin/fortune", NULL, 0, NULL, 0, 5);
|
||||
pid = _kern_create_team("/boot/bin/fortune", "/boot/bin/fortune", NULL, 0, NULL, 0, 5);
|
||||
if (pid >= 0) {
|
||||
int retcode;
|
||||
sys_wait_on_team(pid, &retcode);
|
||||
} else {
|
||||
_kern_wait_for_team(pid, &retcode);
|
||||
} else
|
||||
printf("Failed to create a team for fortune.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while(1) {
|
||||
while (1) {
|
||||
team_id pid;
|
||||
|
||||
pid = sys_create_team("/boot/bin/shell", "/boot/bin/shell", NULL, 0, NULL, 0, 5);
|
||||
if(pid >= 0) {
|
||||
pid = _kern_create_team("/boot/bin/shell", "/boot/bin/shell", NULL, 0, NULL, 0, 5);
|
||||
if (pid >= 0) {
|
||||
int retcode;
|
||||
printf("init: spawned shell, pid 0x%lx\n", pid);
|
||||
sys_wait_on_team(pid, &retcode);
|
||||
_kern_wait_for_team(pid, &retcode);
|
||||
printf("init: shell exited with return code %d\n", retcode);
|
||||
} else {
|
||||
} else
|
||||
printf("Failed to start a shell :(\n");
|
||||
}
|
||||
}
|
||||
|
||||
printf("init exiting\n");
|
||||
|
||||
@@ -14,7 +14,10 @@
|
||||
static void port_test(void);
|
||||
static int32 port_test_thread_func(void* arg);
|
||||
|
||||
static int32 test_thread(void *args)
|
||||
|
||||
#if 0
|
||||
static int32
|
||||
test_thread(void *args)
|
||||
{
|
||||
int i = (int)args;
|
||||
|
||||
@@ -24,19 +27,28 @@ static int32 test_thread(void *args)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int32 dummy_thread(void *args)
|
||||
|
||||
static int32
|
||||
dummy_thread(void *args)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32 cpu_eater_thread(void *args)
|
||||
|
||||
#if 0
|
||||
static int32
|
||||
cpu_eater_thread(void *args)
|
||||
{
|
||||
for(;;)
|
||||
;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int32 fpu_cruncher_thread(void *args)
|
||||
|
||||
static int32
|
||||
fpu_cruncher_thread(void *args)
|
||||
{
|
||||
double y = *(double *)args;
|
||||
double z;
|
||||
@@ -337,16 +349,16 @@ int main(int argc, char **argv)
|
||||
|
||||
printf("%d...", i);
|
||||
|
||||
t = sys_system_time();
|
||||
t = system_time();
|
||||
|
||||
id = sys_create_team("/boot/bin/true", "true", NULL, 0, NULL, 0, 20);
|
||||
id = _kern_create_team("/boot/bin/true", "true", NULL, 0, NULL, 0, 20);
|
||||
if(id <= 0x2) {
|
||||
printf("new team returned 0x%lx!\n", id);
|
||||
return -1;
|
||||
}
|
||||
sys_wait_on_team(id, NULL);
|
||||
_kern_wait_for_team(id, NULL);
|
||||
|
||||
printf("done (%Ld usecs)\n", sys_system_time() - t);
|
||||
printf("done (%Ld usecs)\n", system_time() - t);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -361,21 +373,21 @@ int main(int argc, char **argv)
|
||||
|
||||
printf("spawning %d threads\n", 100);
|
||||
|
||||
for(i=0; i<100; i++) {
|
||||
for (i = 0; i < 100; i++) {
|
||||
thread_id id;
|
||||
bigtime_t t;
|
||||
|
||||
printf("%d...", i);
|
||||
|
||||
t = sys_system_time();
|
||||
t = system_time();
|
||||
|
||||
id = spawn_thread(&dummy_thread, "testthread", B_NORMAL_PRIORITY, NULL);
|
||||
if (id > 0)
|
||||
resume_thread(id);
|
||||
|
||||
sys_wait_on_thread(id, NULL);
|
||||
wait_for_thread(id, NULL);
|
||||
|
||||
printf("done (%Ld usecs)\n", sys_system_time() - t);
|
||||
printf("done (%Ld usecs)\n", system_time() - t);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -416,7 +428,8 @@ int main(int argc, char **argv)
|
||||
|
||||
port_id test_p1, test_p2, test_p3, test_p4;
|
||||
|
||||
static void port_test(void)
|
||||
static void
|
||||
port_test(void)
|
||||
{
|
||||
char testdata[5];
|
||||
thread_id t;
|
||||
@@ -426,29 +439,29 @@ static void port_test(void)
|
||||
|
||||
strcpy(testdata, "abcd");
|
||||
|
||||
printf("porttest: port_create()\n");
|
||||
test_p1 = sys_port_create(1, "test port #1");
|
||||
test_p2 = sys_port_create(10, "test port #2");
|
||||
test_p3 = sys_port_create(1024, "test port #3");
|
||||
test_p4 = sys_port_create(1024, "test port #4");
|
||||
printf("porttest: create_port()\n");
|
||||
test_p1 = create_port(1, "test port #1");
|
||||
test_p2 = create_port(10, "test port #2");
|
||||
test_p3 = create_port(1024, "test port #3");
|
||||
test_p4 = create_port(1024, "test port #4");
|
||||
|
||||
printf("porttest: port_find()\n");
|
||||
printf("'test port #1' has id %ld (should be %ld)\n", sys_port_find("test port #1"), test_p1);
|
||||
printf("porttest: find_port()\n");
|
||||
printf("'test port #1' has id %ld (should be %ld)\n", find_port("test port #1"), test_p1);
|
||||
|
||||
printf("porttest: port_write() on 1, 2 and 3\n");
|
||||
sys_port_write(test_p1, 1, &testdata, sizeof(testdata));
|
||||
sys_port_write(test_p2, 666, &testdata, sizeof(testdata));
|
||||
sys_port_write(test_p3, 999, &testdata, sizeof(testdata));
|
||||
printf("porttest: port_count(test_p1) = %ld\n", sys_port_count(test_p1));
|
||||
printf("porttest: write_port() on 1, 2 and 3\n");
|
||||
write_port(test_p1, 1, &testdata, sizeof(testdata));
|
||||
write_port(test_p2, 666, &testdata, sizeof(testdata));
|
||||
write_port(test_p3, 999, &testdata, sizeof(testdata));
|
||||
printf("porttest: port_count(test_p1) = %ld\n", port_count(test_p1));
|
||||
|
||||
printf("porttest: port_write() on 1 with timeout of 1 sec (blocks 1 sec)\n");
|
||||
sys_port_write_etc(test_p1, 1, &testdata, sizeof(testdata), B_TIMEOUT, 1000000);
|
||||
printf("porttest: port_write() on 2 with timeout of 1 sec (wont block)\n");
|
||||
res = sys_port_write_etc(test_p2, 777, &testdata, sizeof(testdata), B_TIMEOUT, 1000000);
|
||||
printf("porttest: write_port() on 1 with timeout of 1 sec (blocks 1 sec)\n");
|
||||
write_port_etc(test_p1, 1, &testdata, sizeof(testdata), B_TIMEOUT, 1000000);
|
||||
printf("porttest: write_port() on 2 with timeout of 1 sec (wont block)\n");
|
||||
res = write_port_etc(test_p2, 777, &testdata, sizeof(testdata), B_TIMEOUT, 1000000);
|
||||
printf("porttest: res=%d, %s\n", res, res == 0 ? "ok" : "BAD");
|
||||
|
||||
printf("porttest: port_read() on empty port 4 with timeout of 1 sec (blocks 1 sec)\n");
|
||||
res = sys_port_read_etc(test_p4, &dummy, &dummy2, sizeof(dummy2), B_TIMEOUT, 1000000);
|
||||
printf("porttest: read_port() on empty port 4 with timeout of 1 sec (blocks 1 sec)\n");
|
||||
res = read_port_etc(test_p4, &dummy, &dummy2, sizeof(dummy2), B_TIMEOUT, 1000000);
|
||||
printf("porttest: res=%d, %s\n", res, res == ETIMEDOUT ? "ok" : "BAD");
|
||||
|
||||
printf("porttest: spawning thread for port 1\n");
|
||||
@@ -457,30 +470,32 @@ static void port_test(void)
|
||||
resume_thread(t);
|
||||
|
||||
printf("porttest: write\n");
|
||||
sys_port_write(test_p1, 1, &testdata, sizeof(testdata));
|
||||
write_port(test_p1, 1, &testdata, sizeof(testdata));
|
||||
|
||||
// now we can write more (no blocking)
|
||||
printf("porttest: write #2\n");
|
||||
sys_port_write(test_p1, 2, &testdata, sizeof(testdata));
|
||||
write_port(test_p1, 2, &testdata, sizeof(testdata));
|
||||
printf("porttest: write #3\n");
|
||||
sys_port_write(test_p1, 3, &testdata, sizeof(testdata));
|
||||
write_port(test_p1, 3, &testdata, sizeof(testdata));
|
||||
|
||||
printf("porttest: waiting on spawned thread\n");
|
||||
sys_wait_on_thread(t, NULL);
|
||||
wait_for_thread(t, NULL);
|
||||
|
||||
printf("porttest: close p1\n");
|
||||
sys_port_close(test_p2);
|
||||
close_port(test_p2);
|
||||
printf("porttest: attempt write p1 after close\n");
|
||||
res = sys_port_write(test_p2, 4, &testdata, sizeof(testdata));
|
||||
printf("porttest: port_write ret %s (should give Bad port id)\n", strerror(res));
|
||||
res = write_port(test_p2, 4, &testdata, sizeof(testdata));
|
||||
printf("porttest: write_port ret %s (should give Bad port id)\n", strerror(res));
|
||||
|
||||
printf("porttest: testing delete p2\n");
|
||||
sys_port_delete(test_p2);
|
||||
delete_port(test_p2);
|
||||
|
||||
printf("porttest: end test main thread\n");
|
||||
}
|
||||
|
||||
static int32 port_test_thread_func(void* arg)
|
||||
|
||||
static int32
|
||||
port_test_thread_func(void* arg)
|
||||
{
|
||||
int32 msg_code;
|
||||
int n;
|
||||
@@ -488,16 +503,16 @@ static int32 port_test_thread_func(void* arg)
|
||||
|
||||
printf("porttest: port_test_thread_func()\n");
|
||||
|
||||
n = sys_port_read(test_p1, &msg_code, &buf, 3);
|
||||
printf("port_read #1 code %ld len %d buf %3s\n", msg_code, n, buf);
|
||||
n = sys_port_read(test_p1, &msg_code, &buf, 4);
|
||||
printf("port_read #1 code %ld len %d buf %4s\n", msg_code, n, buf);
|
||||
n = read_port(test_p1, &msg_code, &buf, 3);
|
||||
printf("read_port #1 code %ld len %d buf %3s\n", msg_code, n, buf);
|
||||
n = read_port(test_p1, &msg_code, &buf, 4);
|
||||
printf("read_port #1 code %ld len %d buf %4s\n", msg_code, n, buf);
|
||||
buf[4] = 'X';
|
||||
n = sys_port_read(test_p1, &msg_code, &buf, 5);
|
||||
printf("port_read #1 code %ld len %d buf %5s\n", msg_code, n, buf);
|
||||
n = read_port(test_p1, &msg_code, &buf, 5);
|
||||
printf("read_port #1 code %ld len %d buf %5s\n", msg_code, n, buf);
|
||||
|
||||
printf("porttest: testing delete p1 from other thread\n");
|
||||
sys_port_delete(test_p1);
|
||||
delete_port(test_p1);
|
||||
printf("porttest: end port_test_thread_func()\n");
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/*
|
||||
** Copyright 2002-2004, The OpenBeOS Team. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
@@ -17,7 +23,9 @@ struct the_test {
|
||||
sem_id the_lock;
|
||||
};
|
||||
|
||||
static int32 counter_thread(void *data)
|
||||
|
||||
static int32
|
||||
counter_thread(void *data)
|
||||
{
|
||||
struct the_test *tt = (struct the_test*)data;
|
||||
|
||||
@@ -32,11 +40,12 @@ static int32 counter_thread(void *data)
|
||||
}
|
||||
|
||||
|
||||
static int32 priority_test(void *data)
|
||||
static int32
|
||||
priority_test(void *data)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<6; i++) {
|
||||
for (i = 0; i < 6; i++) {
|
||||
printf("%s: %d\n", (char *)data, i);
|
||||
// sys_snooze(1000);
|
||||
}
|
||||
@@ -44,14 +53,15 @@ static int32 priority_test(void *data)
|
||||
}
|
||||
|
||||
|
||||
static int32 communication_test(void *data)
|
||||
static int32
|
||||
communication_test(void *data)
|
||||
{
|
||||
int times = (int)data;
|
||||
int i, code;
|
||||
char buffer[1024];
|
||||
thread_id sender;
|
||||
|
||||
for (i=0; i<times; i++) {
|
||||
for (i = 0; i < times; i++) {
|
||||
code = receive_data(&sender, (void *)buffer, sizeof(buffer));
|
||||
printf(" -> received (%d): \"%s\"\n", code, buffer);
|
||||
}
|
||||
@@ -59,7 +69,8 @@ static int32 communication_test(void *data)
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
thread_id t[THREADS];
|
||||
sem_id lock;
|
||||
@@ -75,8 +86,8 @@ int main(int argc, char **argv)
|
||||
"=============================\n");
|
||||
|
||||
lock = create_sem(1, "test_lock");
|
||||
|
||||
for (i=0;i<THREADS;i++) {
|
||||
|
||||
for (i = 0; i < THREADS; i++) {
|
||||
struct the_test *my_test = (struct the_test*)malloc(sizeof(struct the_test));
|
||||
my_test->the_lock = lock;
|
||||
my_test->current_val = ¤t_val;
|
||||
@@ -89,7 +100,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
sys_wait_on_thread(t[THREADS - 1], NULL);
|
||||
wait_for_thread(t[THREADS - 1], NULL);
|
||||
|
||||
printf("Test value = %d vs expected of %d\n", current_val, expected);
|
||||
|
||||
@@ -105,24 +116,24 @@ int main(int argc, char **argv)
|
||||
printf("Snoozing...\n");
|
||||
snooze(100000);
|
||||
printf("Waiting for threads...");
|
||||
sys_wait_on_thread(t[0], NULL);
|
||||
wait_for_thread(t[0], NULL);
|
||||
printf("1, ");
|
||||
sys_wait_on_thread(t[1], NULL);
|
||||
wait_for_thread(t[1], NULL);
|
||||
printf("2, ");
|
||||
sys_wait_on_thread(t[2], NULL);
|
||||
|
||||
wait_for_thread(t[2], NULL);
|
||||
|
||||
printf("3.\nDone. Spawning commthread...\n");
|
||||
t[0] = spawn_thread(communication_test, "commthread", B_NORMAL_PRIORITY, (void *)5);
|
||||
printf("Spawned. Starting communication...\n");
|
||||
resume_thread(t[0]);
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
for (i = 0; i < 5; i++) {
|
||||
printf("sending");
|
||||
send_data(t[0], i, comm_test[i], strlen(comm_test[i]) + 1);
|
||||
// Give time to the commthread to display info
|
||||
snooze(10000);
|
||||
}
|
||||
sys_wait_on_thread(t[0], NULL);
|
||||
|
||||
wait_for_thread(t[0], NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user