Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

_timer_heapify.c File Reference


Detailed Description

For internal use only.

This file contains the implementation of the _timer_heapify_up() and the _timer_heapify_down() functions, used to restore the heap property in the timer tree.

Definition in file _timer_heapify.c.

#include "event_int.h"

Include dependency graph for _timer_heapify.c:

Go to the source code of this file.

Functions

static ev_err_t node_swap (ev_ctx_t *ctx, ev_tim_t *tim)
 Swap a node with its parent.
ev_err_t _timer_heapify_up (ev_ctx_t *ctx, ev_tim_t *tim)
 Restore timer tree heap property by shifting up.
ev_err_t _timer_heapify_down (ev_ctx_t *ctx, ev_tim_t *tim)
 Restore timer tree heap property by shifting down.


Function Documentation

ev_err_t _timer_heapify_down ev_ctx_t ctx,
ev_tim_t tim
 

For internal use only.

This function restores the heap property of the timer tree by shifting the given node down within the tree.

Test:
This function is tested in t_timer_fcns.c.
Parameters:
[in] ctx A pointer to an ev_ctx_t.
[in] tim A pointer to an ev_tim_t.
Returns:
Zero on success, non-zero if an assertion failure occurs.

Definition at line 121 of file _timer_heapify.c.

References ev_return, ev_trace, node_swap(), _ev_tim_s::ti_expire, _ev_tim_s::ti_node, _ev_timnode_s::tn_left, _ev_timnode_s::tn_right, and tv_comp.

Referenced by _timer_untree(), and timer_resched().

Here is the call graph for this function:

ev_err_t _timer_heapify_up ev_ctx_t ctx,
ev_tim_t tim
 

For internal use only.

This function restores the heap property of the timer tree by shifting the given node up within the tree.

Test:
This function is tested in t_timer_fcns.c.
Parameters:
[in] ctx A pointer to an ev_ctx_t.
[in] tim A pointer to an ev_tim_t.
Returns:
Zero on success, non-zero if an assertion failure occurs.

Definition at line 105 of file _timer_heapify.c.

References ev_return, ev_trace, node_swap(), _ev_tim_s::ti_expire, _ev_tim_s::ti_node, _ev_timnode_s::tn_parent, and tv_comp.

Referenced by _timer_insert(), _timer_untree(), and timer_resched().

Here is the call graph for this function:

static ev_err_t node_swap ev_ctx_t ctx,
ev_tim_t tim
[static]
 

For internal use only.

This helper function swaps a node with its parent, performing, in essence, a tree rotation.

Parameters:
[in] ctx A pointer to an ev_ctx_t.
[in] tim A pointer to an ev_tim_t specifying the timer to rotate up.
Returns:
Zero on success, non-zero if an assertion failure occurs.

Definition at line 47 of file _timer_heapify.c.

References _ev_ctx_s::ec_timtree, ev_assert, ev_return, ev_trace, _ev_tim_s::ti_node, _ev_timnode_s::tn_left, _ev_timnode_s::tn_next, _ev_timnode_s::tn_parent, _ev_timnode_s::tn_prev, _ev_timnode_s::tn_right, and tt_node_fix.

Referenced by _timer_heapify_down(), and _timer_heapify_up().


Generated on Wed Dec 28 23:36:58 2005 for event by  doxygen 1.4.4