Include signal.h for sig_atomic_t in WIN32 #8112

pull sipa wants to merge 1 commits into bitcoin:master from sipa:winsigatomic changing 1 files +0 −2
  1. sipa commented at 11:20 AM on May 28, 2016: member

    We need to include signal.h in WIN32 to get a definition for sig_atomic_t since #8004.

    Perhaps this is only necessary on MinGW, and not on native Windows, but I don't know how to test for that.

  2. Include signal.h for sig_atomic_t in WIN32 88f14b999c
  3. laanwj commented at 7:27 AM on May 30, 2016: member

    Does anyone know what was the rationale to not include signal.h on WIN32 before? Does this break native windows builds?

  4. fanquake commented at 7:52 AM on May 30, 2016: member

    This commit that was part of removing headers.h, moved signal.h into a WIN32 ifndef in main.cpp, but that doesn't have any specific reasoning.

  5. laanwj commented at 10:36 AM on May 30, 2016: member

    If this does break native windows builds, we should do this differently: define our own type, which is a typedef of sig_atomic_t on UNIX-ish OSes, and volatile int or such on Windows, as there are no signals on that OS anyhow.

  6. laanwj commented at 10:38 AM on May 30, 2016: member

    Or could we simply use an c++11 atomic here? Is there something special about sig_atomic_t with signals?

  7. sipa commented at 10:40 AM on May 30, 2016: member

    On Windows, do we even install signal handlers?

  8. laanwj commented at 10:45 AM on May 30, 2016: member

    No (windows uses a different signalling mechanism based on messages) See also https://github.com/bitcoin/bitcoin/blob/master/src/init.cpp#L785

  9. sipa commented at 11:19 AM on May 30, 2016: member

    Then perhaps we should not declare that variable as sig_atomic_t at all on Windows., as it won't be used for its intended purpose anyway.

  10. laanwj commented at 11:23 AM on May 30, 2016: member

    That's what I suggested above: define our own type for it, which is sig_atomic_t only on UNIXish OSes but something else on windows. I still think it should be atomic because at least fRequestShutdown is used to communicate between threads.

    Which means maybe we should simply use a c++11 atomic there, which are available without problems on both Windows and Linux?

  11. sipa commented at 1:44 PM on May 30, 2016: member

    @laanwj I think that's the way to go; see #8123.

  12. laanwj commented at 1:19 PM on May 31, 2016: member

    Closing in favor of #8123

  13. laanwj closed this on May 31, 2016

  14. sipa referenced this in commit 7fa8d75859 on Jun 1, 2016
  15. zkbot referenced this in commit 11ce636a9d on Oct 25, 2016
  16. codablock referenced this in commit d35a0777df on Sep 16, 2017
  17. codablock referenced this in commit 5858d09263 on Sep 19, 2017
  18. codablock referenced this in commit 09eda9783a on Dec 22, 2017
  19. andvgal referenced this in commit be931d0492 on Jan 6, 2019
  20. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 21:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me