зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1285074 - Fix pthreads error reporting for posix js::Mutex; r=terrence
The old code assumed that various pthreads calls would set errno, and therefore we could use perror() to print information about them. That assumption was incorrect: pthreads calls return the error number directly and do not set errno at all. The solution: asign the return value to errno and then call perror();
This commit is contained in:
Родитель
c10280ebcf
Коммит
4edf614ff4
|
@ -4,6 +4,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -13,9 +14,14 @@
|
|||
#include "threading/posix/MutexPlatformData.h"
|
||||
|
||||
#define TRY_CALL_PTHREADS(call, msg) \
|
||||
if ((call) != 0) { \
|
||||
{ \
|
||||
int result = (call); \
|
||||
if (result != 0) { \
|
||||
MOZ_ASSERT(!errno); \
|
||||
errno = result; \
|
||||
perror(msg); \
|
||||
MOZ_CRASH(msg); \
|
||||
} \
|
||||
}
|
||||
|
||||
js::Mutex::Mutex()
|
||||
|
|
Загрузка…
Ссылка в новой задаче