ipc/chromium/src/base/eintr_wrapper.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/chromium/src/base/eintr_wrapper.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +// Copyright (c) 2009 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +// This provides a wrapper around system calls which may be interrupted by a
     1.9 +// signal and return EINTR. See man 7 signal.
    1.10 +//
    1.11 +// On Windows, this wrapper macro does nothing.
    1.12 +
    1.13 +#ifndef BASE_EINTR_WRAPPER_H_
    1.14 +#define BASE_EINTR_WRAPPER_H_
    1.15 +
    1.16 +#include "build/build_config.h"
    1.17 +
    1.18 +#if defined(OS_POSIX)
    1.19 +
    1.20 +#include <errno.h>
    1.21 +
    1.22 +#define HANDLE_EINTR(x) ({ \
    1.23 +  typeof(x) __eintr_result__; \
    1.24 +  do { \
    1.25 +    __eintr_result__ = x; \
    1.26 +  } while (__eintr_result__ == -1 && errno == EINTR); \
    1.27 +  __eintr_result__;\
    1.28 +})
    1.29 +
    1.30 +#else
    1.31 +
    1.32 +#define HANDLE_EINTR(x) x
    1.33 +
    1.34 +#endif  // OS_POSIX
    1.35 +
    1.36 +#endif  // !BASE_EINTR_WRAPPER_H_

mercurial