TEMP_FAILURE_RETRY 宏

发布时间:2023-05-24 09:24:10

The GNU library provides a convenient way to retry a call after a temporary failure, with the macro TEMP_FAILURE_RETRY: — Macro: TEMP_FAILURE_RETRY (expression)

This macro evaluates expression once, and examines its value as type long int. If the value equals -1, that indicates a failure and errno should be set to show what kind of failure. If it fails and reports error code EINTR, TEMP_FAILURE_RETRY evaluates it again, and over and over until the result is not a temporary failure. The value returned by TEMP_FAILURE_RETRY is whatever value expression produced.

/* Used to retry syscalls that can return EINTR. */ #define TEMP_FAILURE_RETRY(exp) ({         \     typeof (exp) _rc;                      \     do {                                   \         _rc = (exp);                       \     } while (_rc == -1 && errno == EINTR); \     _rc; })

上一篇 git submodule的使用
下一篇 chromium template_util.h 解析

文章素材均来源于网络,如有侵权,请联系管理员删除。

标签: Java教程Java基础Java编程技巧面试题Java面试题