Added a thread-safe and robust wrapper for APR pools.
See http://redmine.imprudenceviewer.org/issues/590 and https://jira.secondlife.com/browse/SNOW-596
This commit is contained in:
@@ -43,8 +43,8 @@
|
||||
#include "linden_common.h"
|
||||
#include "llerrorcontrol.h"
|
||||
#include "lltut.h"
|
||||
#include "aiaprpool.h"
|
||||
|
||||
#include "apr_pools.h"
|
||||
#include "apr_getopt.h"
|
||||
|
||||
extern void ll_init_apr();
|
||||
@@ -250,17 +250,12 @@ int main(int argc, char **argv)
|
||||
ctype_workaround();
|
||||
#endif
|
||||
|
||||
ll_init_apr();
|
||||
apr_pool_t* pool = NULL;
|
||||
if(APR_SUCCESS != apr_pool_create(&pool, NULL))
|
||||
{
|
||||
std::cerr << "Unable to initialize pool" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
AIAPRPool pool;
|
||||
pool.create();
|
||||
apr_getopt_t* os = NULL;
|
||||
if(APR_SUCCESS != apr_getopt_init(&os, pool, argc, argv))
|
||||
if(APR_SUCCESS != apr_getopt_init(&os, pool(), argc, argv))
|
||||
{
|
||||
std::cerr << "Unable to pool" << std::endl;
|
||||
std::cerr << "Unable to initialize the arguments for parsing by apr_getopt()." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -362,6 +357,5 @@ int main(int argc, char **argv)
|
||||
s.close();
|
||||
}
|
||||
|
||||
apr_terminate();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user