<commit_before>#ifndef SIGNAL_HELPERS_H
#define SIGNAL_HELPERS_H

// POSIX++
#include <csignal>

// PDTK
#include "error_helpers.h"

#ifndef SIGPOLL
# ifdef SIGIO
#  define SIGPOLL SIGIO
# else
#  error Neither SIGPOLL nor SIGIO is defined
# endif
#endif

#if defined(SA_RESTART) && !defined(INTERRUPTED_WRAPPER)
#pragma message("All default interrupt handlers need to be replaced!")
#endif

namespace posix
{
  template<typename RType, typename... ArgTypes>
  using function = RType(*)(ArgTypes...);

#if defined(SA_RESTART) && !defined(INTERRUPTED_WRAPPER)
  template<typename RType, typename... ArgTypes> constexpr RType  ignore_interruption(function<RType , ArgTypes...> func, ArgTypes... args) { return func(args...); }
  template<typename RType, typename... ArgTypes> constexpr RType* ignore_interruption(function<RType*, ArgTypes...> func, ArgTypes... args) { return func(args...); }
#else
  template<typename RType, typename... ArgTypes>
  static inline RType ignore_interruption(function<RType, ArgTypes...> func, ArgTypes... args) noexcept
  {
    RType rval = error_response;
    do {
      rval = func(args...);
    } while(rval == error_response && errno == std::errc::interrupted);
    return rval;
  }

  template<typename RType, typename... ArgTypes><commit_msg>semantic fix<commit_after>#ifndef SIGNAL_HELPERS_H
#define SIGNAL_HELPERS_H

// POSIX++
#include <csignal>

// PDTK
#include "error_helpers.h"

#ifndef SIGPOLL
# ifdef SIGIO
#  define SIGPOLL SIGIO
# else
#  error Neither SIGPOLL nor SIGIO is defined
# endif
#endif

#if defined(SA_RESTART) && !defined(INTERRUPTED_WRAPPER)
#pragma message("All default interrupt handlers need to be replaced!")
#endif

namespace posix
{
  template<typename RType, typename... ArgTypes>
  using function = RType(*)(ArgTypes...);

#if defined(SA_RESTART) && !defined(INTERRUPTED_WRAPPER)
  template<typename RType, typename... ArgTypes> constexpr RType  ignore_interruption(function<RType , ArgTypes...> func, ArgTypes... args) noexcept { return func(args...); }
  template<typename RType, typename... ArgTypes> constexpr RType* ignore_interruption(function<RType*, ArgTypes...> func, ArgTypes... args) noexcept { return func(args...); }
#else
  template<typename RType, typename... ArgTypes>
  static inline RType ignore_interruption(function<RType, ArgTypes...> func, ArgTypes... args) noexcept
  {
    RType rval = error_response;
    do {
      rval = func(args...);
    } while(rval == error_response && errno == std::errc::interrupted);
    return rval;
  }

  template<typename RType, typename... ArgTypes>
{'fraction_non_alphanumeric': 0.1329187718616401, 'fraction_numerical': 0.0, 'mean_word_length': 4.5, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4706685', 'n_tokens_mistral': 866, 'n_tokens_neox': 823, 'n_words': 218}