Chinaunix

标题: wait_event的疑问 [打印本页]

作者: 怪怪虎    时间: 2010-07-18 18:45
标题: wait_event的疑问
#define wait_event(wq, condition)                                       \
do {                                                                    \
        if (condition)                                                  \
                break;                                                  \
        __wait_event(wq, condition);                                    \
} while (0)

为什么写成do { ..} while(0);
的格式。 这个不是相当于只执行一次吗? 有必要这么写吗?
作者: cookis    时间: 2010-07-18 19:59
这样写宏的时候可以这样   wait_event;
作者: bruceteen    时间: 2010-07-18 20:02
你的这个问题和 http://bbs.chinaunix.net/viewthread.php?tid=670238 类似
作者: 怪怪虎    时间: 2010-07-18 20:15
多谢二楼和三楼的




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2