Flutter Engine
The Flutter Engine
third_party
tonic
filesystem
filesystem
eintr_wrapper.h
Go to the documentation of this file.
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#ifndef FILESYSTEM_EINTR_WRAPPER_H_
6
#define FILESYSTEM_EINTR_WRAPPER_H_
7
8
#include <cerrno>
9
10
#include "
tonic/common/build_config.h
"
11
12
#if defined(OS_WIN)
13
14
// Windows has no concept of EINTR.
15
#define HANDLE_EINTR(x) (x)
16
#define IGNORE_EINTR(x) (x)
17
18
#else
19
20
#if defined(NDEBUG)
21
22
#define HANDLE_EINTR(x) \
23
({ \
24
decltype(x) eintr_wrapper_result; \
25
do { \
26
eintr_wrapper_result = (x); \
27
} while (eintr_wrapper_result == -1 && errno == EINTR); \
28
eintr_wrapper_result; \
29
})
30
31
#else
32
33
#define HANDLE_EINTR(x) \
34
({ \
35
int eintr_wrapper_counter = 0; \
36
decltype(x) eintr_wrapper_result; \
37
do { \
38
eintr_wrapper_result = (x); \
39
} while (eintr_wrapper_result == -1 && errno == EINTR && \
40
eintr_wrapper_counter++ < 100); \
41
eintr_wrapper_result; \
42
})
43
44
#endif
// NDEBUG
45
46
#define IGNORE_EINTR(x) \
47
({ \
48
decltype(x) eintr_wrapper_result; \
49
do { \
50
eintr_wrapper_result = (x); \
51
if (eintr_wrapper_result == -1 && errno == EINTR) { \
52
eintr_wrapper_result = 0; \
53
} \
54
} while (0); \
55
eintr_wrapper_result; \
56
})
57
58
#endif
// defined(OS_WIN)
59
60
#endif
// FILESYSTEM_EINTR_WRAPPER_H_
build_config.h
Generated on Sun Jun 23 2024 21:54:57 for Flutter Engine by
1.9.4