xref: /haiku/headers/private/system/user_timer_defs.h (revision 24df65921befcd0ad0c5c7866118f922da61cb96)
1 /*
2  * Copyright 2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _SYSTEM_USER_TIMER_DEFS_H
6 #define _SYSTEM_USER_TIMER_DEFS_H
7 
8 
9 #include <limits.h>
10 #include <time.h>
11 
12 #include <SupportDefs.h>
13 
14 
15 #define CLOCK_PROCESS_USER_CPUTIME_ID	((clockid_t)-4)
16 	/* clock measuring the used user CPU time of the current process */
17 
18 // limits
19 #define MAX_USER_TIMERS_PER_TEAM		_POSIX_TIMER_MAX
20 	// maximum numbers of user-defined user timers (timer_create())
21 #define MAX_USER_TIMER_OVERRUN_COUNT	INT_MAX
22 	// cap value of a timer's overrun counter
23 
24 #if MAX_USER_TIMER_OVERRUN_COUNT < _POSIX_DELAYTIMER_MAX
25 #	error "MAX_USER_TIMER_OVERRUN_COUNT < _POSIX_DELAYTIMER_MAX"
26 #endif
27 
28 #define USER_TIMER_REAL_TIME_ID				0
29 	// predefined ID for the real time timer
30 #define USER_TIMER_TEAM_TOTAL_TIME_ID		1
31 	// predefined ID for the team's total (kernel + user) time timer
32 #define USER_TIMER_TEAM_USER_TIME_ID		2
33 	// predefined ID for the team's user time timer
34 #define USER_TIMER_FIRST_USER_DEFINED_ID	3
35 	// first ID assigned to a user-defined timer (timer_create())
36 
37 // _kern_create_user_timer() flag:
38 #define USER_TIMER_SIGNAL_THREAD			0x01
39 	// send the signal to the thread instead of the team (valid only for thread
40 	// timers)
41 
42 
43 struct user_timer_info {
44 	bigtime_t	remaining_time;
45 	bigtime_t	interval;
46 	uint32		overrun_count;
47 };
48 
49 
50 #endif	/* _SYSTEM_USER_TIMER_DEFS_H */
51