summaryrefslogtreecommitdiffstats
path: root/libdimension-python/dimension.pyx
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-05-30 15:06:59 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-05-30 15:06:59 -0400
commit2b546944a1f0c5646936f2ab047345769e3a2471 (patch)
treed169d8d61e56c3f5bfc75ae0a505f8667ceedfe3 /libdimension-python/dimension.pyx
parent2edfa06a011307c9e3b8aa6b84c418cb70c0ec7c (diff)
downloaddimension-2b546944a1f0c5646936f2ab047345769e3a2471.tar.xz
python: Add simple global pool interface.
Diffstat (limited to 'libdimension-python/dimension.pyx')
-rw-r--r--libdimension-python/dimension.pyx18
1 files changed, 18 insertions, 0 deletions
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx
index 98fc41d..24ec4bd 100644
--- a/libdimension-python/dimension.pyx
+++ b/libdimension-python/dimension.pyx
@@ -46,6 +46,24 @@ def terminal_width():
"""Return the width of the terminal, if present."""
return dmnsn_terminal_width()
+#########
+# Pools #
+#########
+
+cdef class _Pool:
+ cdef dmnsn_pool *_pool
+
+ def __cinit__(self):
+ self._pool = dmnsn_new_pool()
+
+ def __dealloc__(self):
+ dmnsn_delete_pool(self._pool)
+
+cdef _Pool _global_pool = _Pool()
+
+cdef dmnsn_pool *_get_pool():
+ return _global_pool._pool
+
###########
# Futures #
###########