diff options
| author | Aaron Turon <aturon@mozilla.com> | 2015-06-26 14:32:34 -0700 |
|---|---|---|
| committer | Aaron Turon <aturon@mozilla.com> | 2015-07-02 13:58:38 -0700 |
| commit | d77c4b0fa63d420b2f995e37ee07402f9a243361 (patch) | |
| tree | a437a534c5dee700cfbf834cfa80a2153c2d143d /src/libstd/sys | |
| parent | 2cb8a31e7cea1ee499630c9c6744dedd0c0b371f (diff) | |
| download | rust-d77c4b0fa63d420b2f995e37ee07402f9a243361.tar.gz rust-d77c4b0fa63d420b2f995e37ee07402f9a243361.zip | |
Fix race condition in Arc's get_mut and make_unqiue
This commit resolves the race condition in the `get_mut` and `make_unique` functions, which arose through interaction with weak pointers. The basic strategy is to "lock" the weak pointer count when trying to establish uniqueness, by reusing the field as a simple spinlock. The overhead for normal use of `Arc` is expected to be minimal -- it will be *none* when only strong pointers are used, and only requires a move from atomic increment to CAS for usage of weak pointers. The commit also removes the `unsafe` and deprecated status of these functions. Along the way, the commit also improves several memory orderings, and adds commentary about why various orderings suffice.
Diffstat (limited to 'src/libstd/sys')
0 files changed, 0 insertions, 0 deletions
