Changeset 28352
- Timestamp:
- Jun 16, 2010, 12:05:05 PM (16 years ago)
- Location:
- tags/ipp-20100610/psLib
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
src/db/psDB.c (modified) (1 diff)
-
src/sys/psThread.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20100610/psLib
- Property svn:mergeinfo changed
/trunk/psLib merged: 28350-28351
- Property svn:mergeinfo changed
-
tags/ipp-20100610/psLib/src/db/psDB.c
r25315 r28352 1524 1524 } 1525 1525 case PS_DATA_F64: { 1526 bind[i].length = 0; 1527 bind[i].buffer = &item->data.F64; 1528 bind[i].is_null = psDBIsPTypeNaN(item->type, &item->data.F64) ? &isNull : NULL; 1529 break; 1530 } 1526 // This hack is to work around a MySQL bug, where values of DBL_MAX are dumped (as text) with 1527 // insufficient digits, causing the value to be rounded outside the bounds of DBL_MAX 1528 // (specifically, -1.7976931348623157e+308 gets dumped as -1.79769313486232e+308 which is less 1529 // than -DBL_MAX), which cannot then be loaded by MySQL. We assume that we're using doubles for 1530 // additional precision compared to floats, and not for additional size, so limiting to the 1531 // maximum value of a float is not damaging. 1532 if (item->data.F64 < -FLT_MAX) { 1533 psWarning("Saturating double value at -FLT_MAX to work around MySQL bug: %lf --> %lf", 1534 item->data.F64, -FLT_MAX); 1535 item->data.F64 = -FLT_MAX; 1536 } else if (item->data.F64 > FLT_MAX) { 1537 psWarning("Saturating double value at FLT_MAX to work around MySQL bug: %lf --> %lf", 1538 item->data.F64, FLT_MAX); 1539 item->data.F64 = FLT_MAX; 1540 } 1541 bind[i].length = 0; 1542 bind[i].buffer = &item->data.F64; 1543 bind[i].is_null = psDBIsPTypeNaN(item->type, &item->data.F64) ? &isNull : NULL; 1544 break; 1545 } 1531 1546 case PS_DATA_BOOL: { 1532 1547 // XXX: ASC HACK NOTE (2005/06/03): set extreme bytes to the -
tags/ipp-20100610/psLib/src/sys/psThread.c
r28315 r28352 7 7 #include <unistd.h> 8 8 #include <string.h> 9 10 // Backtrace to help nail down bugs 11 #ifdef HAVE_BACKTRACE 12 #include <execinfo.h> 13 #include <stdlib.h> 14 #define BACKTRACE_BUFFER_SIZE 256 // Maximum size of backtrace 15 static void **bt_buffer = NULL; // Backtrace buffer 16 static int bt_size = 0; // Backtrace buffer size 17 #endif 9 18 10 19 #include "psAssert.h" … … 33 42 static psArray *tsd = NULL; // Thread-specific data 34 43 44 35 45 /***** basic thread functions *****/ 36 46 … … 91 101 PS_ASSERT_THREAD_JOB_NON_NULL(job, false); 92 102 103 psThreadTask *task = psHashLookup(tasks, job->type); // Task to execute job 104 psAssert(task, "Unable to find task %s", job->type); 105 psAssert(job->args->n == task->nArgs, "invalid number of arguments to %s", task->type); 106 93 107 // if we failed to call psThreadPoolInit, or we called it with nThreads == 0, 94 108 // find the matching function and just run it. … … 101 115 psListAdd(done, PS_LIST_TAIL, job); 102 116 103 // find the corresponding task and run it104 psThreadTask *task = psHashLookup(tasks, job->type); // Task to execute job105 psAssert(task, "Unable to find task %s", job->type);106 psAssert(job->args->n == task->nArgs, "invalid number of arguments to %s", task->type);107 117 return task->function(job); 108 118 } … … 209 219 210 220 psThreadTask *task = psHashLookup(tasks, job->type); // Task to execute job 221 #ifdef HAVE_BACKTRACE 222 if (!task && bt_buffer) { 223 psLogMsg("psLib.sys", PS_LOG_ABORT, "Backtrace of waiter:\n"); 224 char **strings = backtrace_symbols((void *const *)bt_buffer, bt_size); 225 psLogMsg("psLib.sys", PS_LOG_ABORT, "Backtrace depth: %d", bt_size); 226 for (int i = 0; i < bt_size; i++) { 227 char *caller = strchr(strings[i], '('); 228 if (caller) { 229 caller++; 230 size_t callerLength = abs(strchr(caller, '+') - caller); 231 psString name = psStringNCopy(caller, callerLength); 232 psLogMsg("psLib.sys", PS_LOG_ABORT, "Backtrace %d: %s", i, name); 233 psFree(name); 234 } else { 235 psLogMsg("psLib.sys", PS_LOG_ABORT, "Backtrace %d: (unknown)", i); 236 } 237 } 238 } 239 #endif 211 240 psAssert(task, "Couldn't find thread task %s", job->type); 212 241 psAssert(job->args->n == task->nArgs, … … 282 311 return true; 283 312 } 313 314 #ifdef HAVE_BACKTRACE 315 if (bt_buffer) { 316 psFree(bt_buffer); 317 } 318 bt_buffer = psAlloc(BACKTRACE_BUFFER_SIZE * sizeof(void *)); 319 bt_size = backtrace(bt_buffer, BACKTRACE_BUFFER_SIZE); 320 #endif 284 321 285 322 while (1) { … … 343 380 tsd = NULL; 344 381 382 #ifdef HAVE_BACKTRACE 383 if (bt_buffer) { 384 psFree(bt_buffer); 385 } 386 #endif 387 345 388 return true; 346 389 }
Note:
See TracChangeset
for help on using the changeset viewer.
