]> git.saurik.com Git - cycript.git/blobdiff - Pooling.hpp
Changed from a threaded pool to a thread-local pool, abstracted out token assignment...
[cycript.git] / Pooling.hpp
index d1ee2b7a0f537f018c4ee5d4b58473bff5b4b108..96b49326701e766e51834b457aa4e5b9ac718d55 100644 (file)
@@ -44,6 +44,7 @@
 #include <apr_strings.h>
 
 #include "Exception.hpp"
+#include "Local.hpp"
 #include "Standard.hpp"
 
 #include <cstdlib>
@@ -169,4 +170,21 @@ struct CYPoolAllocator {
     };
 };
 
+class CYLocalPool :
+    public CYPool
+{
+  private:
+    CYLocal<apr_pool_t *> local_;
+
+  public:
+    CYLocalPool() :
+        CYPool(),
+        local_(operator apr_pool_t *())
+    {
+    }
+};
+
+#define $pool \
+    CYLocal<apr_pool_t *>::Top()
+
 #endif/*CYPOOLING_HPP*/