If select failed with errno == EINTR, there is a signal in the signal_pipe, put there by the handler that handled the signal, that you should read before your next call to IsPendingTermination().
So how about combining the two `if`s above into a single `if (select_ret == -1 && errno != EINTR)` so that this code is in its else clause and the EINTR case does flush the pipe ?