Commit 3bb369c
committed
Use libpthread primitives for OpenBSD mutexes.
There has been some discussion as to whether this is the right approach,
centered around internal pointers in the underlying mutex structure.
After much thought, let's commit this for now. The argument:
* While it is true that OpenBSD has futex(2) and in fact is used in
the underlying implementations in Dispatch. I'm not confident right now
creating robust locking primitives by hand from futexes.
It would be ideal to just delegate all of this to Dispatch, but
Dispatch doesn't expose a ready-use API for mutexes. Cobbling one
together might be possible, but that would take some time and finesse.
* While recent versions of C and C++ have language support for mutexes,
they are implemented in many cases by libpthread anyway, so there
is nothing inherently gained right now by not using the pthread API
other than portability.
* While the concern for internal pointers for the pthread API is
important, the OpenBSD is mitigated by the fact that pthread_mutex_t is
pointer-valued on the platform. The concern that this might not always
be the case is mitigated by the fact that this commit does not attempt
to use the pthread implementation as a catch-all for all platforms.
* The alternative is to use MutexUnavailable, but given Foundation has
some dependencies on Mutex, this may cause problems elsewhere
throughout the port.1 parent 1d38956 commit 3bb369c
File tree
2 files changed
+69
-0
lines changed- stdlib/public/Synchronization
- Mutex
2 files changed
+69
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
| |||
115 | 122 | | |
116 | 123 | | |
117 | 124 | | |
| 125 | + | |
| 126 | + | |
118 | 127 | | |
119 | 128 | | |
120 | 129 | | |
| |||
140 | 149 | | |
141 | 150 | | |
142 | 151 | | |
| 152 | + | |
| 153 | + | |
143 | 154 | | |
144 | 155 | | |
145 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
0 commit comments