Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | // This provides a wrapper around system calls which may be interrupted by a |
michael@0 | 6 | // signal and return EINTR. See man 7 signal. |
michael@0 | 7 | // |
michael@0 | 8 | // On Windows, this wrapper macro does nothing. |
michael@0 | 9 | |
michael@0 | 10 | #ifndef BASE_EINTR_WRAPPER_H_ |
michael@0 | 11 | #define BASE_EINTR_WRAPPER_H_ |
michael@0 | 12 | |
michael@0 | 13 | #include "build/build_config.h" |
michael@0 | 14 | |
michael@0 | 15 | #if defined(OS_POSIX) |
michael@0 | 16 | |
michael@0 | 17 | #include <errno.h> |
michael@0 | 18 | |
michael@0 | 19 | #define HANDLE_EINTR(x) ({ \ |
michael@0 | 20 | typeof(x) __eintr_result__; \ |
michael@0 | 21 | do { \ |
michael@0 | 22 | __eintr_result__ = x; \ |
michael@0 | 23 | } while (__eintr_result__ == -1 && errno == EINTR); \ |
michael@0 | 24 | __eintr_result__;\ |
michael@0 | 25 | }) |
michael@0 | 26 | |
michael@0 | 27 | #else |
michael@0 | 28 | |
michael@0 | 29 | #define HANDLE_EINTR(x) x |
michael@0 | 30 | |
michael@0 | 31 | #endif // OS_POSIX |
michael@0 | 32 | |
michael@0 | 33 | #endif // !BASE_EINTR_WRAPPER_H_ |