why use while(0) to write set_current_state
June 17, 2015
5:01 a.m.
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
June 17, 2015
5:15 a.m.
On Jun 16, 2015, at 10:01 PM, 慕冬亮 <mudongliangabcd@gmail.com> wrote:
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?
Read this and you will know why. http://kernelnewbies.org/FAQ/DoWhile0
mudongliang _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
4076
Age (days ago)
4076
Last active (days ago)
1 comments
2 participants
participants (2)
-
Anish Kumar -
慕冬亮