超时宏定义

点击查看代码
#define CHECK_TIMEOUT(condition, msg) \
    do { \
        uint32_t timeout = 100000; \
        while(condition) { \
            if(timeout-- == 0) { \
                printf("[ERROR] %s | File: %s | Line: %d\r\n", msg, __FILE__, __LINE__); \
                return 0; \
            } \
        } \
    } while(0)

posted on 2025-12-26 18:33  程序员纽扣  阅读(0)  评论(0)    收藏  举报

导航