why use while(0) to write set_current_state

慕冬亮 mudongliangabcd at gmail.com
Wed Jun 17 01:01:20 EDT 2015


I see the macro in the include/linux/sched.h
#define __set_current_state(state_value) \
do { current->state = (state_value); } while (0)

Why define it like this? What's the meaning of while?
mudongliang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20150617/26747777/attachment.html 


More information about the Kernelnewbies mailing list