activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r558843 - /activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/util/Config.h
Date Mon, 23 Jul 2007 19:41:15 GMT
Author: tabish
Date: Mon Jul 23 12:41:14 2007
New Revision: 558843

URL: http://svn.apache.org/viewvc?view=rev&rev=558843
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103

Modified:
    activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/util/Config.h

Modified: activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/util/Config.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/util/Config.h?view=diff&rev=558843&r1=558842&r2=558843
==============================================================================
--- activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/util/Config.h (original)
+++ activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/util/Config.h Mon Jul 23 12:41:14
2007
@@ -87,4 +87,35 @@
 #endif
 
 
+// Define a class to hanlde APR initialization and termination, then declare a global
+// static instance that will cause the library to only be initialized once.
+#include <apr_general.h>
+#include <apr_pools.h>
+
+class _APR_LIBRARY {
+private:
+
+    // Global APR memory pool
+    apr_pool_t* memoryPool;
+
+public:
+
+    _APR_LIBRARY() {
+        apr_initialize();
+        apr_pool_create( &memoryPool, NULL );
+    }
+
+    ~_APR_LIBRARY() {
+        apr_pool_destroy( memoryPool );
+        apr_terminate();
+    }
+
+    apr_pool_t* getMemoryPool() const{
+        return memoryPool;
+    }
+
+};
+
+static _APR_LIBRARY _decaf_apr;
+
 #endif /*_DECAF_UTIL_CONFIG_H_*/



Mime
View raw message