Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modernize and improve the timer module
Remove most of the timer management overhead from the single timer server process, and decentralize the actual process of timing, to make the timer server more efficient and less prone to becoming overloaded. The outward behavior of the timer module is unchanged. - Start the timer server under kernel_sup instead of kernel_safe_sup. - Move argument validations out of the timer server and into the API functions. - One-shot send timers are using erlang:send_after and erlang:cancel_timer in the client process, without going through the timer server, when the destination is a pid on the local node. - The timer server does not do any actual timing any more but only executes actions and reschedules interval timers. Instead, erlang:start_timer is used for the timing. - The timer table is not named any more, an ets:tid() is carried in a state variable instead. - Processes related to interval timers are monitored (vs linked) by the timer server in order to cancel them when the related process dies. - timer:sleep/1 now accepts arbitrarily high integer values. Integer values above the limit of what is allowed in the after clause of a receive expression are split up. - Document that send_after and send_interval accept {RegName, Node} as message destinations. - The function get_status/0 that was only used in tests has been removed, the tests now use sys:get_state instead. - Test return values.
- Loading branch information