diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llcommon/llapr.cpp | 10 | ||||
-rw-r--r-- | linden/indra/llcommon/llapr.h | 1 | ||||
-rw-r--r-- | linden/indra/llcommon/llerror.cpp | 65 | ||||
-rw-r--r-- | linden/indra/llcommon/llversionviewer.h | 2 |
4 files changed, 77 insertions, 1 deletions
diff --git a/linden/indra/llcommon/llapr.cpp b/linden/indra/llcommon/llapr.cpp index 82530b1..669afc5 100644 --- a/linden/indra/llcommon/llapr.cpp +++ b/linden/indra/llcommon/llapr.cpp | |||
@@ -38,6 +38,7 @@ | |||
38 | apr_pool_t *gAPRPoolp = NULL; // Global APR memory pool | 38 | apr_pool_t *gAPRPoolp = NULL; // Global APR memory pool |
39 | LLVolatileAPRPool *LLAPRFile::sAPRFilePoolp = NULL ; //global volatile APR memory pool. | 39 | LLVolatileAPRPool *LLAPRFile::sAPRFilePoolp = NULL ; //global volatile APR memory pool. |
40 | apr_thread_mutex_t *gLogMutexp = NULL; | 40 | apr_thread_mutex_t *gLogMutexp = NULL; |
41 | apr_thread_mutex_t *gCallStacksLogMutexp = NULL; | ||
41 | 42 | ||
42 | const S32 FULL_VOLATILE_APR_POOL = 1024 ; //number of references to LLVolatileAPRPool | 43 | const S32 FULL_VOLATILE_APR_POOL = 1024 ; //number of references to LLVolatileAPRPool |
43 | 44 | ||
@@ -51,6 +52,7 @@ void ll_init_apr() | |||
51 | 52 | ||
52 | // Initialize the logging mutex | 53 | // Initialize the logging mutex |
53 | apr_thread_mutex_create(&gLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp); | 54 | apr_thread_mutex_create(&gLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp); |
55 | apr_thread_mutex_create(&gCallStacksLogMutexp, APR_THREAD_MUTEX_UNNESTED, gAPRPoolp); | ||
54 | } | 56 | } |
55 | 57 | ||
56 | if(!LLAPRFile::sAPRFilePoolp) | 58 | if(!LLAPRFile::sAPRFilePoolp) |
@@ -72,6 +74,14 @@ void ll_cleanup_apr() | |||
72 | apr_thread_mutex_destroy(gLogMutexp); | 74 | apr_thread_mutex_destroy(gLogMutexp); |
73 | gLogMutexp = NULL; | 75 | gLogMutexp = NULL; |
74 | } | 76 | } |
77 | if (gCallStacksLogMutexp) | ||
78 | { | ||
79 | // Clean up the logging mutex | ||
80 | |||
81 | // All other threads NEED to be done before we clean up APR, so this is okay. | ||
82 | apr_thread_mutex_destroy(gCallStacksLogMutexp); | ||
83 | gCallStacksLogMutexp = NULL; | ||
84 | } | ||
75 | if (gAPRPoolp) | 85 | if (gAPRPoolp) |
76 | { | 86 | { |
77 | apr_pool_destroy(gAPRPoolp); | 87 | apr_pool_destroy(gAPRPoolp); |
diff --git a/linden/indra/llcommon/llapr.h b/linden/indra/llcommon/llapr.h index 44ad2dd..63130a8 100644 --- a/linden/indra/llcommon/llapr.h +++ b/linden/indra/llcommon/llapr.h | |||
@@ -49,6 +49,7 @@ | |||
49 | #include "llstring.h" | 49 | #include "llstring.h" |
50 | 50 | ||
51 | extern apr_thread_mutex_t* gLogMutexp; | 51 | extern apr_thread_mutex_t* gLogMutexp; |
52 | extern apr_thread_mutex_t* gCallStacksLogMutexp; | ||
52 | 53 | ||
53 | /** | 54 | /** |
54 | * @brief initialize the common apr constructs -- apr itself, the | 55 | * @brief initialize the common apr constructs -- apr itself, the |
diff --git a/linden/indra/llcommon/llerror.cpp b/linden/indra/llcommon/llerror.cpp index 5e520af..a0e42c1 100644 --- a/linden/indra/llcommon/llerror.cpp +++ b/linden/indra/llcommon/llerror.cpp | |||
@@ -1242,9 +1242,62 @@ namespace LLError | |||
1242 | char** LLCallStacks::sBuffer = NULL ; | 1242 | char** LLCallStacks::sBuffer = NULL ; |
1243 | S32 LLCallStacks::sIndex = 0 ; | 1243 | S32 LLCallStacks::sIndex = 0 ; |
1244 | 1244 | ||
1245 | class CallStacksLogLock | ||
1246 | { | ||
1247 | public: | ||
1248 | CallStacksLogLock(); | ||
1249 | ~CallStacksLogLock(); | ||
1250 | bool ok() const { return mOK; } | ||
1251 | private: | ||
1252 | bool mLocked; | ||
1253 | bool mOK; | ||
1254 | }; | ||
1255 | |||
1256 | CallStacksLogLock::CallStacksLogLock() | ||
1257 | : mLocked(false), mOK(false) | ||
1258 | { | ||
1259 | if (!gCallStacksLogMutexp) | ||
1260 | { | ||
1261 | mOK = true; | ||
1262 | return; | ||
1263 | } | ||
1264 | |||
1265 | const int MAX_RETRIES = 5; | ||
1266 | for (int attempts = 0; attempts < MAX_RETRIES; ++attempts) | ||
1267 | { | ||
1268 | apr_status_t s = apr_thread_mutex_trylock(gCallStacksLogMutexp); | ||
1269 | if (!APR_STATUS_IS_EBUSY(s)) | ||
1270 | { | ||
1271 | mLocked = true; | ||
1272 | mOK = true; | ||
1273 | return; | ||
1274 | } | ||
1275 | |||
1276 | ms_sleep(1); | ||
1277 | } | ||
1278 | |||
1279 | // We're hosed, we can't get the mutex. Blah. | ||
1280 | std::cerr << "CallStacksLogLock::CallStacksLogLock: failed to get mutex for log" | ||
1281 | << std::endl; | ||
1282 | } | ||
1283 | |||
1284 | CallStacksLogLock::~CallStacksLogLock() | ||
1285 | { | ||
1286 | if (mLocked) | ||
1287 | { | ||
1288 | apr_thread_mutex_unlock(gCallStacksLogMutexp); | ||
1289 | } | ||
1290 | } | ||
1291 | |||
1245 | //static | 1292 | //static |
1246 | void LLCallStacks::push(const char* function, const int line) | 1293 | void LLCallStacks::push(const char* function, const int line) |
1247 | { | 1294 | { |
1295 | CallStacksLogLock lock; | ||
1296 | if (!lock.ok()) | ||
1297 | { | ||
1298 | return; | ||
1299 | } | ||
1300 | |||
1248 | if(!sBuffer) | 1301 | if(!sBuffer) |
1249 | { | 1302 | { |
1250 | sBuffer = new char*[512] ; | 1303 | sBuffer = new char*[512] ; |
@@ -1280,6 +1333,12 @@ namespace LLError | |||
1280 | //static | 1333 | //static |
1281 | void LLCallStacks::end(std::ostringstream* _out) | 1334 | void LLCallStacks::end(std::ostringstream* _out) |
1282 | { | 1335 | { |
1336 | CallStacksLogLock lock; | ||
1337 | if (!lock.ok()) | ||
1338 | { | ||
1339 | return; | ||
1340 | } | ||
1341 | |||
1283 | if(!sBuffer) | 1342 | if(!sBuffer) |
1284 | { | 1343 | { |
1285 | sBuffer = new char*[512] ; | 1344 | sBuffer = new char*[512] ; |
@@ -1302,6 +1361,12 @@ namespace LLError | |||
1302 | //static | 1361 | //static |
1303 | void LLCallStacks::print() | 1362 | void LLCallStacks::print() |
1304 | { | 1363 | { |
1364 | CallStacksLogLock lock; | ||
1365 | if (!lock.ok()) | ||
1366 | { | ||
1367 | return; | ||
1368 | } | ||
1369 | |||
1305 | if(sIndex > 0) | 1370 | if(sIndex > 0) |
1306 | { | 1371 | { |
1307 | llinfos << " ************* PRINT OUT LL CALL STACKS ************* " << llendl ; | 1372 | llinfos << " ************* PRINT OUT LL CALL STACKS ************* " << llendl ; |
diff --git a/linden/indra/llcommon/llversionviewer.h b/linden/indra/llcommon/llversionviewer.h index a393a4e..e18befc 100644 --- a/linden/indra/llcommon/llversionviewer.h +++ b/linden/indra/llcommon/llversionviewer.h | |||
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | const S32 LL_VERSION_MAJOR = 1; | 36 | const S32 LL_VERSION_MAJOR = 1; |
37 | const S32 LL_VERSION_MINOR = 23; | 37 | const S32 LL_VERSION_MINOR = 23; |
38 | const S32 LL_VERSION_PATCH = 1; | 38 | const S32 LL_VERSION_PATCH = 2; |
39 | const S32 LL_VERSION_BUILD = 0; | 39 | const S32 LL_VERSION_BUILD = 0; |
40 | 40 | ||
41 | const char * const LL_CHANNEL = "Second Life Release"; | 41 | const char * const LL_CHANNEL = "Second Life Release"; |