xref: /haiku/src/tests/system/kernel/yield_test.cpp (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2  * Copyright 2006, Axel Dörfler, axeld@pinc-software.de.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <OS.h>
8 #include <syscalls.h>
9 
10 
11 status_t
12 looper(void *)
13 {
14 	while (true) {
15 		_kern_thread_yield();
16 	}
17 
18 	return B_OK;
19 }
20 
21 
22 int
23 main()
24 {
25 	thread_id thread = spawn_thread(looper, "Real-Time Looper", B_REAL_TIME_PRIORITY, NULL);
26 	if (thread < B_OK)
27 		return -1;
28 
29 	resume_thread(thread);
30 	wait_for_thread(thread, NULL);
31 
32 	return 0;
33 }
34