Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: runtime/bin/thread_android.cc

Issue 1450113003: Avoid strerror_r portability issues (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: oops namespace Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/process_macos.cc ('k') | runtime/bin/thread_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_ANDROID) 6 #if defined(TARGET_OS_ANDROID)
7 7
8 #include "bin/thread.h" 8 #include "bin/thread.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
11 #include <sys/time.h> // NOLINT 11 #include <sys/time.h> // NOLINT
12 12
13 #include "platform/assert.h" 13 #include "platform/assert.h"
14 #include "platform/utils.h"
14 15
15 namespace dart { 16 namespace dart {
16 namespace bin { 17 namespace bin {
17 18
18 #define VALIDATE_PTHREAD_RESULT(result) \ 19 #define VALIDATE_PTHREAD_RESULT(result) \
19 if (result != 0) { \ 20 if (result != 0) { \
20 const int kBufferSize = 1024; \ 21 const int kBufferSize = 1024; \
21 char error_message[kBufferSize]; \ 22 char error_message[kBufferSize]; \
22 strerror_r(result, error_message, kBufferSize); \ 23 Utils::StrError(result, error_message, kBufferSize); \
23 FATAL2("pthread error: %d (%s)", result, error_message); \ 24 FATAL2("pthread error: %d (%s)", result, error_message); \
24 } 25 }
25 26
26 27
27 #ifdef DEBUG 28 #ifdef DEBUG
28 #define RETURN_ON_PTHREAD_FAILURE(result) \ 29 #define RETURN_ON_PTHREAD_FAILURE(result) \
29 if (result != 0) { \ 30 if (result != 0) { \
30 const int kBufferSize = 1024; \ 31 const int kBufferSize = 1024; \
31 char error_message[kBufferSize]; \ 32 char error_message[kBufferSize]; \
32 strerror_r(result, error_message, kBufferSize); \ 33 Utils::StrError(result, error_message, kBufferSize); \
33 fprintf(stderr, "%s:%d: pthread error: %d (%s)\n", \ 34 fprintf(stderr, "%s:%d: pthread error: %d (%s)\n", \
34 __FILE__, __LINE__, result, error_message); \ 35 __FILE__, __LINE__, result, error_message); \
35 return result; \ 36 return result; \
36 } 37 }
37 #else 38 #else
38 #define RETURN_ON_PTHREAD_FAILURE(result) \ 39 #define RETURN_ON_PTHREAD_FAILURE(result) \
39 if (result != 0) return result; 40 if (result != 0) return result;
40 #endif 41 #endif
41 42
42 43
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 void Monitor::NotifyAll() { 325 void Monitor::NotifyAll() {
325 // TODO(iposva): Do we need to track lock owners? 326 // TODO(iposva): Do we need to track lock owners?
326 int result = pthread_cond_broadcast(data_.cond()); 327 int result = pthread_cond_broadcast(data_.cond());
327 VALIDATE_PTHREAD_RESULT(result); 328 VALIDATE_PTHREAD_RESULT(result);
328 } 329 }
329 330
330 } // namespace bin 331 } // namespace bin
331 } // namespace dart 332 } // namespace dart
332 333
333 #endif // defined(TARGET_OS_ANDROID) 334 #endif // defined(TARGET_OS_ANDROID)
OLDNEW
« no previous file with comments | « runtime/bin/process_macos.cc ('k') | runtime/bin/thread_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698