Commit Graph

11 Commits

Author SHA1 Message Date
Alastair Houghton 90946f03cd [Threading] Add _WIN64 conditional version of ULONG_PTR.
`ULONG_PTR` is defined slightly differently on `_WIN64` builds.

rdar://113898653
2025-03-27 18:56:25 +00:00
Alastair Houghton 21aeead848 [Concurrency] Add Win32 implementation for recursive mutex.
We're using `CRITICAL_SECTION` here, as that supports recursion.

rdar://113898653
2025-03-27 15:25:39 +00:00
Alastair Houghton 3d6f2036b3 [Threading][Win32] Fix a warning.
The `RTL_SRWLOCK_INIT` declaration got reformatted and doesn't exactly
match what's in `windows.h`, so we're getting warnings during builds.
Fix to match what it says in the system header.

rdar://105400572
2023-02-13 17:43:01 +00:00
Alastair Houghton 4495d63c12 [Threading] Add ConditionVariable support.
Swift Concurrency would like to be able to use condition variables.
Add support to the threading packages.

rdar://100236038
2022-09-27 16:21:13 +01:00
Alastair Houghton 0e9318cec5 [Threading] Put everything through git clang-format.
Just formatting changes.

rdar://90776105
2022-06-07 07:39:53 +01:00
Alastair Houghton d6cff94e7f [Threading][Windows] Try to avoid declaring _RTL_SRWLOCK
Declaring _RTL_SRWLOCK ourselves causes clashes with <windows.h>.
Rather than doing that, declare an equivalent struct, and some overloads.

rdar://90776105
2022-06-07 07:39:52 +01:00
Alastair Houghton 2e28ac4f01 [Threading][Windows] Don't include <windows.h>
We can't safely include <windows.h> because it defines a large number
of macros, some of which clash with things in the Swift source tree,
and others of which clash with things in the LLVM source tree.  Sadly
we *also* can't just include the Windows headers we need, because they
pull in some of the problematic macros.

In this instance, the best thing seems to be to grab the definitions
for the types and functions we are going to use and put them in their
own header file.  If we define them correctly, then #including
<windows.h> before or after this header won't have any adverse effects.

rdar://90776105
2022-06-07 07:39:52 +01:00
Alex Hoppen 4aa2bbbf06 Revert "Merge pull request #42447 from al45tair/eng/PR-90776105"
This reverts commit 8bcb71140f, reversing
changes made to c4dd271d36.
2022-06-02 18:03:23 +02:00
Alastair Houghton b5bd267ff1 [Threading] Put everything through git clang-format.
Just formatting changes.

rdar://90776105
2022-05-24 14:57:41 +01:00
Alastair Houghton d090bb0c3e [Threading][Windows] Try to avoid declaring _RTL_SRWLOCK
Declaring _RTL_SRWLOCK ourselves causes clashes with <windows.h>.
Rather than doing that, declare an equivalent struct, and some overloads.

rdar://90776105
2022-05-24 14:57:41 +01:00
Alastair Houghton b718432946 [Threading][Windows] Don't include <windows.h>
We can't safely include <windows.h> because it defines a large number
of macros, some of which clash with things in the Swift source tree,
and others of which clash with things in the LLVM source tree.  Sadly
we *also* can't just include the Windows headers we need, because they
pull in some of the problematic macros.

In this instance, the best thing seems to be to grab the definitions
for the types and functions we are going to use and put them in their
own header file.  If we define them correctly, then #including
<windows.h> before or after this header won't have any adverse effects.

rdar://90776105
2022-05-24 14:57:40 +01:00