Re: [PATCH 01/10] Add handle_eintr to wrap EINTR handling in syscalls

Tom Tromey
2020-09-03T14:17:20Z

>>>>> "Kamil" == Kamil Rytarowski <n54@gmx.com> writes:

Kamil> +2020-03-17 Kamil Rytarowski <n54@gmx.com>
Kamil> +
Kamil> + * eintr.h: Add handle_eintr.

Kamil> +template <typename Fun, typename... Args>
Kamil> +inline decltype (auto) handle_eintr (const Fun &F, const Args &... A)

I like this, but from what I read it seems that "decltype(auto)" is
C++14 -- but gdb is still C++11.

Kamil> +{
Kamil> + decltype (F (A...)) ret;
Kamil> + do
Kamil> + {
Kamil> + errno = 0;
Kamil> + ret = F (A...);
Kamil> + }
Kamil> + while (ret == -1 && errno == EINTR);

Also this seems to assume that "ret" is comparable to an int anyway.
So maybe just assuming int everywhere would be ok.

Tom