Added a test for the on_exit_thread() implementation.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3072 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2003-04-18 09:17:29 +00:00
parent c61687ba31
commit f68d61b912
2 changed files with 44 additions and 0 deletions
+1
View File
@@ -9,6 +9,7 @@ KernelObjects
sig_test.c
select_test.c
tls_test.c
on_exit_thread.c
;
SubInclude OBOS_TOP src kernel apps cpuinfo ;
+43
View File
@@ -0,0 +1,43 @@
#include <OS.h>
#include <stdio.h>
static void
first(void *data)
{
printf("first on_exit_thread(): %ld\n", (int32)data);
}
static void
second(void *data)
{
printf("second on_exit_thread(): %ld\n", (int32)data);
}
static int32
thread(void *data)
{
puts("Nurse Stimpy for the rescue!");
on_exit_thread(first, (void *)11);
on_exit_thread(second, (void *)22);
return 0;
}
int
main(int argc, char **argv)
{
status_t status;
thread_id id;
on_exit_thread(first, (void *)666);
id = spawn_thread(thread, "mythread", B_NORMAL_PRIORITY, (void *)42);
resume_thread(id);
wait_for_thread(id, &status);
return 0;
}