Caffe2 - C++ API
A deep learning, cross platform ML framework
Related Pages
Modules
Data Structures
Files
C++ API
Python API
GitHub
File List
Globals
torch
lib
libshm
err.h
1
#pragma once
2
3
#include <system_error>
4
#include <cerrno>
5
6
// `errno` is only meaningful when it fails. E.g., a successful `fork()` sets
7
// `errno` to `EINVAL` in child process on some macos
8
// (https://stackoverflow.com/a/20295079), and thus `errno` should really only
9
// be inspected if an error occured.
10
//
11
// All functions used in `libshm` (so far) indicate error by returning `-1`. If
12
// you want to use a function with a different error reporting mechanism, you
13
// need to port `SYSCHECK` from `torch/lib/c10d/Utils.hpp`.
14
#define SYSCHECK_ERR_RETURN_NEG1(expr) \
15
while (true) { \
16
if ((expr) == -1) { \
17
if (errno == EINTR) { \
18
continue; \
19
} else { \
20
throw std::system_error(errno, std::system_category()); \
21
} \
22
} else { \
23
break; \
24
} \
25
}
Generated on Thu Mar 21 2019 13:06:24 for Caffe2 - C++ API by
1.8.11