KolibriOS kernel
timers.inc File Reference

Classes

struct  TIMER
 This structure describes a timer for the kernel. More...
 

Functions

void timer_hs (dword deltaStart, dword interval, dword timerFunc, dword userData)
 This function adds a timer. If deltaStart is nonzero, the timer is activated after deltaStart hundredths of seconds starting from the current time. If interval is nonzero, the timer is activated every deltaWork hundredths of seconds starting from the first activation. The activated timer calls timerFunc as stdcall function with one argument userData. Return value is NULL if something has failed or some value which is opaque for the caller. Later this value can be used for cancel_timer_hs. More...
 
void check_timers_has_work ()
 This is a simplified version of check_timers that does not call anything, just checks whether check_timers should do something. More...
 

Variables

label timer_list
 The head of timer list. More...
 
dd timer_list_owner
 These two variables are used to synchronize access to the global list. Logically, they form an recursive mutex. Physically, the first variable holds the slot number of the current owner or 0, the second variable holds the recursion count. The mutex should be recursive to allow a timer function to add/delete other timers or itself. More...
 
dd timer_list_numlocks
 
dd timer_next
 A timer function can delete any timer, including itself and the next timer in the chain. To handle such situation correctly, we keep the next timer in a global variable, so the removing operation can update it. More...
 
label lock_timer_list
 This internal function acquires the lock for the global list. More...
 
label unlock_timer_list
 This internal function releases the lock for the global list. More...
 
label cancel_timer_hs
 This function removes a timer. The only argument is [esp+4] = the value which was returned from timer_hs. More...
 
label check_timers
 This function is regularly called from osloop. It processes the global list and activates the corresponding timers. More...
 

Function Documentation

◆ check_timers_has_work()

void check_timers_has_work ( )

This is a simplified version of check_timers that does not call anything, just checks whether check_timers should do something.

Source
core/timers.inc:207

◆ timer_hs()

void timer_hs ( dword  deltaStart,
dword  interval,
dword  timerFunc,
dword  userData 
)

This function adds a timer. If deltaStart is nonzero, the timer is activated after deltaStart hundredths of seconds starting from the current time. If interval is nonzero, the timer is activated every deltaWork hundredths of seconds starting from the first activation. The activated timer calls timerFunc as stdcall function with one argument userData. Return value is NULL if something has failed or some value which is opaque for the caller. Later this value can be used for cancel_timer_hs.

Source
core/timers.inc:81

Variable Documentation

◆ cancel_timer_hs

label cancel_timer_hs

This function removes a timer. The only argument is [esp+4] = the value which was returned from timer_hs.

Source
core/timers.inc:127

◆ check_timers

label check_timers

This function is regularly called from osloop. It processes the global list and activates the corresponding timers.

Source
core/timers.inc:155

◆ lock_timer_list

label lock_timer_list

This internal function acquires the lock for the global list.

Source
core/timers.inc:50

◆ timer_list

label timer_list

The head of timer list.

Source
core/timers.inc:30

◆ timer_list_numlocks

dd timer_list_numlocks
Initial value
0
Source
core/timers.inc:42

◆ timer_list_owner

dd timer_list_owner

These two variables are used to synchronize access to the global list. Logically, they form an recursive mutex. Physically, the first variable holds the slot number of the current owner or 0, the second variable holds the recursion count. The mutex should be recursive to allow a timer function to add/delete other timers or itself.

Initial value
0
Source
core/timers.inc:41

◆ timer_next

dd timer_next

A timer function can delete any timer, including itself and the next timer in the chain. To handle such situation correctly, we keep the next timer in a global variable, so the removing operation can update it.

Initial value
0
Source
core/timers.inc:46

◆ unlock_timer_list

label unlock_timer_list

This internal function releases the lock for the global list.

Source
core/timers.inc:65