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:
@@ -9,6 +9,7 @@ KernelObjects
|
|||||||
sig_test.c
|
sig_test.c
|
||||||
select_test.c
|
select_test.c
|
||||||
tls_test.c
|
tls_test.c
|
||||||
|
on_exit_thread.c
|
||||||
;
|
;
|
||||||
|
|
||||||
SubInclude OBOS_TOP src kernel apps cpuinfo ;
|
SubInclude OBOS_TOP src kernel apps cpuinfo ;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user