Commit Graph

16 Commits

Author SHA1 Message Date
3405691582
c787d50984 Fix typo in SwiftPrivateThreadExtras.
Co-Authored-By: Sergej Jaskiewicz <broadwaylamb@users.noreply.github.com>
2020-03-03 20:24:06 -05:00
3405691582
5847726f51 Preliminary support for OpenBSD in the stdlib.
These should hopefully all be uncontroversial, minimal changes to deal
with progressing the build to completion on OpenBSD or addressing minor
portability issues. This is not the full set of changes to get a
successful build; other portability issues will be addressed in future
commits.

Most of this is just adding the relevant clauses to the ifdefs, but of
note in this commit:

* StdlibUnittest.swift: the default conditional in _getOSVersion assumes
  an Apple platform, therefore the explicit conditional and the relevant
  enums need filling out. The default conditional should be #error, but
  we'll fix this in a different commit.

* tgmath.swift.gyb: inexplicably, OpenBSD is missing just lgammal_r.
  Tests are updated correspondingly.

* ThreadLocalStorage.h: we use the pthread implementation, so it
  seems we should typedef __swift_thread_key_t as pthread_key_t.
  However, that's also a tweak for another commit.
2020-03-01 12:50:06 -05:00
Chris Amanse
ffa6bf4729 Fix memory leaks in ThreadBarriers.swift (#12212)
* Fix memory leaks in ThreadBarriers.swift

* Fatal error on pthread cond/mutex destroy failure

* Rename pthread to thread

* Fix pthread init function calls

* Fix guard statement
2020-01-29 08:21:52 -08:00
Saleem Abdulrasool
dcc10ba39f SwiftPrivateThreadExtras: address improvement suggestions
Use `ThreadHandle(bitPattern:)` rather than `unsafeBitCast` for the
conversion of the `uintptr_t` to the `HANDLE`.  Convert a variable from
`var` to `let` binding.
2019-02-16 10:31:04 -08:00
Saleem Abdulrasool
59371dba24 SwiftPrivateThreadExtras: fix casting due to API changes
The recent changes to the UnsafemutablePointer prevented the "abuse" of
the type for casting.  Switch to `unsafeBitCast`.  This should repair
the Windows build.
2019-02-13 08:13:47 -08:00
Xiaodi Wu
9fe28c6e55 [gardening] Fix header comments [NFC] 2018-12-02 15:38:41 -05:00
Saleem Abdulrasool
98d71ff38f SwiftPrivateThreadExtras: clean up using WinSDK SDK overlay
Use the constants rather than hardcoding values.
2018-12-01 11:04:13 -08:00
Saleem Abdulrasool
c32daed203 SwiftPrivateThreadExtras: fix windows build
Missed casts and a let vs var issue.  This was missed in the last bundle
of patches.
2018-11-29 22:19:00 -08:00
Saleem Abdulrasool
ce40d72641 stdlib: implement _stdlib_pthread_join in terms of Windows threading
Implement `_stdlib_pthread_join` in terms of windows threading.
Additionally, rename it to `_stdlib_thread_join`.
2018-11-26 13:10:00 -08:00
Saleem Abdulrasool
6bf7b9e711 stdlib: implement _stdlib_create_pthread_block in terms of Windows threaing
Port the block based thread constructor to Windows threading model, and
rename it to `_stdlib_create_thread_block`.
2018-11-26 13:10:00 -08:00
Saleem Abdulrasool
5e943981c7 stdlib: rename some variables in _stdlib_barrier 2018-11-26 13:10:00 -08:00
Saleem Abdulrasool
65bdce00b6 stdlib: rename _stdlib_PTHREAD_BARRIER_SERIAL_THREAD -> _stdlib_THREAD_BARRIER_SERIAL_THREAD 2018-11-26 13:10:00 -08:00
Saleem Abdulrasool
7b06586fe1 stdlib: rename _stdlib_pthread_barrier_t to _stdlib_thread_barrier_t 2018-11-26 13:09:49 -08:00
Saleem Abdulrasool
940db1b0cf stdlib: remove pthread_attr_t from _stdlib_pthread_create_block
The attributes were not being used currently.  Since this is a private
interface, remove the parameter as it makes it easier to port to
Windows.
2018-11-26 13:09:31 -08:00
Saleem Abdulrasool
82360c6b27 stdlib: remove pthread_barrier attributes
These were not in use, and removing this from the signature makes it
possible to re-use the exact signature on Windows more easily.
2018-11-26 13:09:31 -08:00
Saleem Abdulrasool
0693bec1f1 sdlib: rename SwiftPrivatePthreadExtras to SwiftPrivateThreadExtras
This is in preparation to make the code here more target agnostic for
porting to the Windows threading primitives.  This is used pretty
extensively in the tests, so disabling tests would lose a chunk of
coverage.
2018-11-26 13:09:31 -08:00