summaryrefslogtreecommitdiff
path: root/pjlib
diff options
context:
space:
mode:
Diffstat (limited to 'pjlib')
-rw-r--r--pjlib/include/pj/timer.h9
-rw-r--r--pjlib/src/pj/timer.c5
2 files changed, 14 insertions, 0 deletions
diff --git a/pjlib/include/pj/timer.h b/pjlib/include/pj/timer.h
index 59149385..df6155a8 100644
--- a/pjlib/include/pj/timer.h
+++ b/pjlib/include/pj/timer.h
@@ -213,6 +213,15 @@ PJ_DECL(pj_timer_entry*) pj_timer_entry_init( pj_timer_entry *entry,
pj_timer_heap_callback *cb );
/**
+ * Queries whether a timer entry is currently running.
+ *
+ * @param entry The timer entry to query.
+ *
+ * @return PJ_TRUE if the timer is running. PJ_FALSE if not.
+ */
+PJ_DECL(pj_bool_t) pj_timer_entry_running( pj_timer_entry *entry );
+
+/**
* Schedule a timer entry which will expire AFTER the specified delay.
*
* @param ht The timer heap.
diff --git a/pjlib/src/pj/timer.c b/pjlib/src/pj/timer.c
index b9205c81..931a57fa 100644
--- a/pjlib/src/pj/timer.c
+++ b/pjlib/src/pj/timer.c
@@ -466,6 +466,11 @@ PJ_DEF(pj_timer_entry*) pj_timer_entry_init( pj_timer_entry *entry,
return entry;
}
+PJ_DEF(pj_bool_t) pj_timer_entry_running( pj_timer_entry *entry )
+{
+ return (entry->_timer_id >= 1);
+}
+
#if PJ_TIMER_DEBUG
static pj_status_t schedule_w_grp_lock_dbg(pj_timer_heap_t *ht,
pj_timer_entry *entry,