You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/07/23 21:41:15 UTC
svn commit: r558843 -
/activemq/activemq-cpp/trunk/src/decaf/src/main/decaf/util/Config.h
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_*/