aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/media_plugins
diff options
context:
space:
mode:
authorAleric Inglewood2010-11-10 15:19:13 +0100
committerAleric Inglewood2010-11-17 01:03:18 +0100
commitb66950bc26cfb3210e786c966141b20a5cc13a84 (patch)
tree5afd535bfd59f1fb1fc6d9132958965c527aa0ee /linden/indra/media_plugins
parentIMP-712: Add shortcut for the Groups tab. (diff)
downloadmeta-impy-b66950bc26cfb3210e786c966141b20a5cc13a84.zip
meta-impy-b66950bc26cfb3210e786c966141b20a5cc13a84.tar.gz
meta-impy-b66950bc26cfb3210e786c966141b20a5cc13a84.tar.bz2
meta-impy-b66950bc26cfb3210e786c966141b20a5cc13a84.tar.xz
IMP-590: Added a thread-safe and robust wrapper for APR pools.
See http://redmine.imprudenceviewer.org/issues/590
Diffstat (limited to 'linden/indra/media_plugins')
-rw-r--r--linden/indra/media_plugins/webkit/linux_volume_catcher.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/linden/indra/media_plugins/webkit/linux_volume_catcher.cpp b/linden/indra/media_plugins/webkit/linux_volume_catcher.cpp
index c4c4181..cc3836e 100644
--- a/linden/indra/media_plugins/webkit/linux_volume_catcher.cpp
+++ b/linden/indra/media_plugins/webkit/linux_volume_catcher.cpp
@@ -58,7 +58,7 @@ extern "C" {
58#include <pulse/subscribe.h> 58#include <pulse/subscribe.h>
59#include <pulse/glib-mainloop.h> // There's no special reason why we want the *glib* PA mainloop, but the generic polling implementation seems broken. 59#include <pulse/glib-mainloop.h> // There's no special reason why we want the *glib* PA mainloop, but the generic polling implementation seems broken.
60 60
61#include "apr_pools.h" 61#include "aiaprpool.h"
62#include "apr_dso.h" 62#include "apr_dso.h"
63} 63}
64 64
@@ -74,7 +74,7 @@ extern "C" {
74#undef LL_PA_SYM 74#undef LL_PA_SYM
75 75
76static bool sSymsGrabbed = false; 76static bool sSymsGrabbed = false;
77static apr_pool_t *sSymPADSOMemoryPool = NULL; 77static AIAPRPool sSymPADSOMemoryPool;
78static apr_dso_handle_t *sSymPADSOHandleG = NULL; 78static apr_dso_handle_t *sSymPADSOHandleG = NULL;
79 79
80bool grab_pa_syms(std::string pulse_dso_name) 80bool grab_pa_syms(std::string pulse_dso_name)
@@ -93,11 +93,11 @@ bool grab_pa_syms(std::string pulse_dso_name)
93#define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##PASYM, sSymPADSOHandle, #PASYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #PASYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #PASYM, (void*)ll##PASYM);}while(0) 93#define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##PASYM, sSymPADSOHandle, #PASYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #PASYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #PASYM, (void*)ll##PASYM);}while(0)
94 94
95 //attempt to load the shared library 95 //attempt to load the shared library
96 apr_pool_create(&sSymPADSOMemoryPool, NULL); 96 sSymPADSOMemoryPool.create();
97 97
98 if ( APR_SUCCESS == (rv = apr_dso_load(&sSymPADSOHandle, 98 if ( APR_SUCCESS == (rv = apr_dso_load(&sSymPADSOHandle,
99 pulse_dso_name.c_str(), 99 pulse_dso_name.c_str(),
100 sSymPADSOMemoryPool) )) 100 sSymPADSOMemoryPool()) ))
101 { 101 {
102 INFOMSG("Found DSO: %s", pulse_dso_name.c_str()); 102 INFOMSG("Found DSO: %s", pulse_dso_name.c_str());
103 103
@@ -140,11 +140,7 @@ void ungrab_pa_syms()
140 sSymPADSOHandleG = NULL; 140 sSymPADSOHandleG = NULL;
141 } 141 }
142 142
143 if ( sSymPADSOMemoryPool ) 143 sSymPADSOMemoryPool.destroy();
144 {
145 apr_pool_destroy(sSymPADSOMemoryPool);
146 sSymPADSOMemoryPool = NULL;
147 }
148 144
149 // NULL-out all of the symbols we'd grabbed 145 // NULL-out all of the symbols we'd grabbed
150#define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) do{ll##PASYM = NULL;}while(0) 146#define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) do{ll##PASYM = NULL;}while(0)