summaryrefslogtreecommitdiffstats
path: root/libdimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-06-14 16:26:53 -0600
committerTavian Barnes <tavianator@gmail.com>2011-06-14 16:28:39 -0600
commit8c9a97f4cf9f8d55d48981f3d7170f27ce853ce5 (patch)
tree85fbe40ce7b6c8e3d2c10b872737a4cdc2f81727 /libdimension
parent9ed4a01ac4305baff9e5ee1484691e78def105a1 (diff)
downloaddimension-8c9a97f4cf9f8d55d48981f3d7170f27ce853ce5.tar.xz
Add Timers to Python module.
Diffstat (limited to 'libdimension')
-rw-r--r--libdimension/dimension/timer.h2
-rw-r--r--libdimension/timer.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/libdimension/dimension/timer.h b/libdimension/dimension/timer.h
index 0a1fde9..bd72a90 100644
--- a/libdimension/dimension/timer.h
+++ b/libdimension/dimension/timer.h
@@ -28,6 +28,8 @@ typedef struct dmnsn_timer {
double real; /**< Wall-clock time. */
double user; /**< Time spent executing. */
double system; /**< Time spent waiting for the system. */
+
+ dmnsn_refcount refcount; /**< @internal Reference count. */
} dmnsn_timer;
/** A standard format string for timers. */
diff --git a/libdimension/timer.c b/libdimension/timer.c
index 0e120ce..ad0fd9b 100644
--- a/libdimension/timer.c
+++ b/libdimension/timer.c
@@ -30,6 +30,7 @@ dmnsn_new_timer(void)
{
dmnsn_timer *timer = dmnsn_malloc(sizeof(dmnsn_timer));
dmnsn_get_times(timer);
+ timer->refcount = 1;
return timer;
}
@@ -46,5 +47,7 @@ dmnsn_complete_timer(dmnsn_timer *timer)
void
dmnsn_delete_timer(dmnsn_timer *timer)
{
- dmnsn_free(timer);
+ if (DMNSN_DECREF(timer)) {
+ dmnsn_free(timer);
+ }
}