On Fri, May 1, 2009 at 12:35 PM, Adam Langley <a...@chromium.org> wrote: > On POSIX, it uses GCC magic to return the correct type based on the expression > and restarts the system call if it throws EINTR. Here it is: > > #define HANDLE_EINTR(x) ({ \ > typeof(x) ret; \ > do { \ > ret = x; \ > } while (ret == -1 && errno == EINTR); \ > ret;\ > })
Wow, that's pretty deep magic. > And you can use it like: > HANDLE_EINTR(close(fd)); Isn't it disaster if you say: HANDLE_EINTR(close(ret)); Adam --~--~---------~--~----~------------~-------~--~----~ Chromium Developers mailing list: chromium-dev@googlegroups.com View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev -~----------~----~----~----~------~----~------~--~---