metal-cos/tests/threadtest.c

37 lines
686 B
C
Raw Normal View History

2015-01-18 23:15:55 +00:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
// Castor Only
#include <syscall.h>
void
threadEntry(uint64_t arg)
{
printf("Hello From Thread %d\n", arg);
OSThreadExit(arg);
}
int
main(int argc, const char *argv[])
{
char buf[256];
printf("Thread Test\n");
OSThreadCreate((uintptr_t)&threadEntry, 2);
OSThreadCreate((uintptr_t)&threadEntry, 3);
OSThreadCreate((uintptr_t)&threadEntry, 4);
int result = OSThreadWait(0);
printf("Result %d\n", result);
result = OSThreadWait(0);
printf("Result %d\n", result);
result = OSThreadWait(0);
printf("Result %d\n", result);
printf("Success!\n");
}