0
点赞
收藏
分享

微信扫一扫

TEMP_FAILURE_RETRY 宏

圣杰 2023-05-23 阅读 65


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; })

举报

相关推荐

temp

MRT temp

Guava Retry

mysql中as temp

Network failure

0 条评论