* Added TRACE macro to see what timers are set/cancelled.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30166 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-04-15 10:21:58 +00:00
parent b4a57bf88b
commit a96e91db3b

View File

@ -1,5 +1,5 @@
/*
* Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -20,6 +20,14 @@
#include "stack_private.h"
//#define TRACE_UTILITY
#ifdef TRACE_UTILITY
# define TRACE(x...) dprintf(x)
#else
# define TRACE(x...) ;
#endif
// internal Fifo class which doesn't maintain it's own lock
// TODO: do we need this one for anything?
class Fifo {
@ -489,19 +497,21 @@ init_timer(net_timer* timer, net_timer_func hook, void* data)
}
/*!
Sets or cancels a timer. When the \a delay is below zero, an eventually running
timer is canceled, if not, it is scheduled to be executed after the specified
\a delay.
/*! Sets or cancels a timer. When the \a delay is below zero, an eventually
running timer is canceled, if not, it is scheduled to be executed after the
specified \a delay.
You need to have initialized the timer before calling this function.
In case you need to change a running timer, you have to cancel it first, before
making any changes.
In case you need to change a running timer, you have to cancel it first,
before making any changes.
*/
void
set_timer(net_timer* timer, bigtime_t delay)
{
MutexLocker locker(sTimerLock);
TRACE("set_timer %p, hook %p, data %p\n", timer, timer->hook, timer->data);
if (timer->due > 0 && delay < 0) {
// this timer is scheduled, cancel it
list_remove_item(&sTimers, timer);
@ -527,6 +537,9 @@ cancel_timer(struct net_timer* timer)
{
MutexLocker locker(sTimerLock);
TRACE("cancel_timer %p, hook %p, data %p\n", timer, timer->hook,
timer->data);
if (timer->due <= 0)
return false;