summaryrefslogtreecommitdiff
path: root/src/common/timer.c
diff options
context:
space:
mode:
authorFlipp <mysteriousragnarok@hotmail.com>2013-07-22 14:20:58 -0700
committerFlipp <mysteriousragnarok@hotmail.com>2013-07-22 14:20:58 -0700
commit056c181e1c163b7d49c87bc07bf82ef11fdbd539 (patch)
tree3d0e0857b3e6bdaff5ca5a9461d1d1e530b57dba /src/common/timer.c
parent0090e0303d9dd56e91b88fa331c3952097c592da (diff)
parentc0c254f14d0d65a8b7ec50720ed8d98b5a04919a (diff)
downloadhercules-056c181e1c163b7d49c87bc07bf82ef11fdbd539.tar.gz
hercules-056c181e1c163b7d49c87bc07bf82ef11fdbd539.tar.bz2
hercules-056c181e1c163b7d49c87bc07bf82ef11fdbd539.tar.xz
hercules-056c181e1c163b7d49c87bc07bf82ef11fdbd539.zip
Merge pull request #64 from piotrhalaczkiewicz/master
Binary heap fix & improvement.
Diffstat (limited to 'src/common/timer.c')
-rw-r--r--src/common/timer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/timer.c b/src/common/timer.c
index 955a971c8..f019c6927 100644
--- a/src/common/timer.c
+++ b/src/common/timer.c
@@ -195,7 +195,7 @@ unsigned int timer_gettick(void) {
/// Adds a timer to the timer_heap
static void push_timer_heap(int tid) {
BHEAP_ENSURE(timer_heap, 1, 256);
- BHEAP_PUSH(timer_heap, tid, DIFFTICK_MINTOPCMP);
+ BHEAP_PUSH(timer_heap, tid, DIFFTICK_MINTOPCMP, swap);
}
/*==========================
@@ -322,9 +322,9 @@ int timer_settick(int tid, unsigned int tick) {
return (int)tick;// nothing to do, already in propper position
// pop and push adjusted timer
- BHEAP_POPINDEX(timer_heap, i, DIFFTICK_MINTOPCMP);
+ BHEAP_POPINDEX(timer_heap, i, DIFFTICK_MINTOPCMP, swap);
timer_data[tid].tick = tick;
- BHEAP_PUSH(timer_heap, tid, DIFFTICK_MINTOPCMP);
+ BHEAP_PUSH(timer_heap, tid, DIFFTICK_MINTOPCMP, swap);
return (int)tick;
}
@@ -342,7 +342,7 @@ int do_timer(unsigned int tick) {
break; // no more expired timers to process
// remove timer
- BHEAP_POP(timer_heap, DIFFTICK_MINTOPCMP);
+ BHEAP_POP(timer_heap, DIFFTICK_MINTOPCMP, swap);
timer_data[tid].type |= TIMER_REMOVE_HEAP;
if( timer_data[tid].func ) {