xref: /haiku/src/tests/system/kernel/yield_test.cpp (revision 5e96d7d537fbec23bad4ae9b4c8e7b02e769f0c6)
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