diff -Nru rust-parking-lot-0.10.2/appveyor.yml rust-parking-lot-0.11.2/appveyor.yml --- rust-parking-lot-0.10.2/appveyor.yml 2019-11-24 22:05:57.000000000 +0000 +++ rust-parking-lot-0.11.2/appveyor.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -environment: - TRAVIS_CARGO_NIGHTLY_FEATURE: nightly - RUST_TEST_THREADS: 1 - matrix: - - TARGET: x86_64-pc-windows-msvc - MSYSTEM: MINGW64 - CPU: x86_64 - TOOLCHAIN: nightly - FEATURES: nightly - - TARGET: i686-pc-windows-msvc - MSYSTEM: MINGW32 - CPU: i686 - TOOLCHAIN: nightly - FEATURES: nightly - - TARGET: x86_64-pc-windows-gnu - MSYSTEM: MINGW64 - CPU: x86_64 - TOOLCHAIN: nightly - FEATURES: nightly - - TARGET: i686-pc-windows-gnu - MSYSTEM: MINGW32 - CPU: i686 - TOOLCHAIN: nightly - FEATURES: nightly - - TARGET: x86_64-pc-windows-msvc - MSYSTEM: MINGW64 - CPU: x86_64 - TOOLCHAIN: 1.36.0 - - TARGET: i686-pc-windows-msvc - MSYSTEM: MINGW32 - CPU: i686 - TOOLCHAIN: 1.36.0 - - TARGET: x86_64-pc-windows-gnu - MSYSTEM: MINGW64 - CPU: x86_64 - TOOLCHAIN: 1.36.0 - - TARGET: i686-pc-windows-gnu - MSYSTEM: MINGW32 - CPU: i686 - TOOLCHAIN: 1.36.0 - -install: - - set PATH=C:\msys64\%MSYSTEM%\bin;c:\msys64\usr\bin;%PATH% - - pacman --noconfirm -Syu mingw-w64-%CPU%-make - - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - - rustup-init.exe -y --default-host %TARGET% --default-toolchain %TOOLCHAIN% - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - rustc -vV - - cargo -vV - -build_script: - - cargo build --features "%FEATURES%" - -test_script: - - cargo test --all --features "%FEATURES%" - - cargo doc --all - - cd benchmark - - cargo run --release --bin mutex -- 2 1 0 1 2 - - cargo run --release --bin rwlock -- 1 1 1 0 1 2 diff -Nru rust-parking-lot-0.10.2/bors.toml rust-parking-lot-0.11.2/bors.toml --- rust-parking-lot-0.10.2/bors.toml 2020-04-10 13:50:06.000000000 +0000 +++ rust-parking-lot-0.11.2/bors.toml 1973-11-29 21:33:09.000000000 +0000 @@ -1,3 +1,4 @@ status = [ - "continuous-integration/travis-ci/push", + "build_tier_one", + "build_other_platforms", ] diff -Nru rust-parking-lot-0.10.2/Cargo.toml rust-parking-lot-0.11.2/Cargo.toml --- rust-parking-lot-0.10.2/Cargo.toml 2020-04-10 22:07:04.000000000 +0000 +++ rust-parking-lot-0.11.2/Cargo.toml 1970-01-01 00:00:01.000000000 +0000 @@ -3,17 +3,16 @@ # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies -# to registry (e.g., crates.io) dependencies +# to registry (e.g., crates.io) dependencies. # -# If you believe there's an error in this file please file an -# issue against the rust-lang/cargo repository. If you're -# editing this file be aware that the upstream Cargo.toml -# will likely look very different (and much more reasonable) +# If you are reading this file be aware that the original Cargo.toml +# will likely look very different (and much more reasonable). +# See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "parking_lot" -version = "0.10.2" +version = "0.11.2" authors = ["Amanieu d'Antras "] description = "More compact and efficient implementations of the standard synchronization primitives." readme = "README.md" @@ -21,20 +20,27 @@ categories = ["concurrency"] license = "Apache-2.0/MIT" repository = "https://github.com/Amanieu/parking_lot" +[dependencies.instant] +version = "0.1.9" + [dependencies.lock_api] -version = "0.3.4" +version = "0.4.5" [dependencies.parking_lot_core] -version = "0.7.1" +version = "0.8.4" [dev-dependencies.bincode] -version = "1.1.3" +version = "1.3.3" [dev-dependencies.rand] -version = "0.7" +version = "0.8.3" [features] +arc_lock = ["lock_api/arc_lock"] deadlock_detection = ["parking_lot_core/deadlock_detection"] default = [] nightly = ["parking_lot_core/nightly", "lock_api/nightly"] owning_ref = ["lock_api/owning_ref"] +send_guard = [] serde = ["lock_api/serde"] +stdweb = ["instant/stdweb"] +wasm-bindgen = ["instant/wasm-bindgen"] diff -Nru rust-parking-lot-0.10.2/Cargo.toml.orig rust-parking-lot-0.11.2/Cargo.toml.orig --- rust-parking-lot-0.10.2/Cargo.toml.orig 2020-04-10 22:04:42.000000000 +0000 +++ rust-parking-lot-0.11.2/Cargo.toml.orig 1973-11-29 21:33:09.000000000 +0000 @@ -1,6 +1,6 @@ [package] name = "parking_lot" -version = "0.10.2" +version = "0.11.2" authors = ["Amanieu d'Antras "] description = "More compact and efficient implementations of the standard synchronization primitives." license = "Apache-2.0/MIT" @@ -11,21 +11,26 @@ edition = "2018" [dependencies] -parking_lot_core = { path = "core", version = "0.7.1" } -lock_api = { path = "lock_api", version = "0.3.4" } +parking_lot_core = { path = "core", version = "0.8.4" } +lock_api = { path = "lock_api", version = "0.4.5" } +instant = "0.1.9" [dev-dependencies] -rand = "0.7" +rand = "0.8.3" # Used when testing out serde support. -bincode = {version = "1.1.3"} +bincode = "1.3.3" [features] default = [] +arc_lock = ["lock_api/arc_lock"] owning_ref = ["lock_api/owning_ref"] nightly = ["parking_lot_core/nightly", "lock_api/nightly"] deadlock_detection = ["parking_lot_core/deadlock_detection"] serde = ["lock_api/serde"] +stdweb = ["instant/stdweb"] +wasm-bindgen = ["instant/wasm-bindgen"] +send_guard = [] [workspace] exclude = ["benchmark"] diff -Nru rust-parking-lot-0.10.2/.cargo_vcs_info.json rust-parking-lot-0.11.2/.cargo_vcs_info.json --- rust-parking-lot-0.10.2/.cargo_vcs_info.json 2020-04-10 22:07:04.000000000 +0000 +++ rust-parking-lot-0.11.2/.cargo_vcs_info.json 1970-01-01 00:00:01.000000000 +0000 @@ -1,5 +1,5 @@ { "git": { - "sha1": "4cb93a3268fcf79c823a3d860047e3e88c626b51" + "sha1": "18001b819c1539c06c176c671bbe54e70b5c3d69" } } diff -Nru rust-parking-lot-0.10.2/CHANGELOG.md rust-parking-lot-0.11.2/CHANGELOG.md --- rust-parking-lot-0.10.2/CHANGELOG.md 2020-04-10 22:04:34.000000000 +0000 +++ rust-parking-lot-0.11.2/CHANGELOG.md 1973-11-29 21:33:09.000000000 +0000 @@ -1,3 +1,55 @@ +## parking_lot 0.11.2, parking_lot_core 0.8.4, lock_api 0.4.5 (2021-08-28) + +- Fixed incorrect memory orderings on `RwLock` and `WordLock`. (#294, #292) +- Added `Arc`-based lock guards. (#291) +- Added workaround for TSan's lack of support for `fence`. (#292) + +## lock_api 0.4.4 (2021-05-01) + +- Update for latest nightly. (#281) + +## lock_api 0.4.3 (2021-04-03) + +- Added `[Raw]ReentrantMutex::is_owned`. (#280) + +## parking_lot_core 0.8.3 (2021-02-12) + +- Updated smallvec to 1.6. (#276) + +## parking_lot_core 0.8.2 (2020-12-21) + +- Fixed assertion failure on OpenBSD. (#270) + +## parking_lot_core 0.8.1 (2020-12-04) + +- Removed deprecated CloudABI support. (#263) +- Fixed build on wasm32-unknown-unknown. (#265) +- Relaxed dependency on `smallvec`. (#266) + +## parking_lot 0.11.1, lock_api 0.4.2 (2020-11-18) + +- Fix bounds on Send and Sync impls for lock guards. (#262) +- Fix incorrect memory ordering in `RwLock`. (#260) + +## lock_api 0.4.1 (2020-07-06) + +- Add `data_ptr` method to lock types to allow unsafely accessing the inner data + without a guard. (#247) + +## parking_lot 0.11.0, parking_lot_core 0.8.0, lock_api 0.4.0 (2020-06-23) + +- Add `is_locked` method to mutex types. (#235) +- Make `RawReentrantMutex` public. (#233) +- Allow lock guard to be sent to another thread with the `send_guard` feature. (#240) +- Use `Instant` type from the `instant` crate on wasm32-unknown-unknown. (#231) +- Remove deprecated and unsound `MappedRwLockWriteGuard::downgrade`. (#244) +- Most methods on the `Raw*` traits have been made unsafe since they assume + the current thread holds the lock. (#243) + +## parking_lot_core 0.7.2 (2020-04-21) + +- Add support for `wasm32-unknown-unknown` under the "nightly" feature. (#226) + ## parking_lot 0.10.2 (2020-04-10) - Update minimum version of `lock_api`. diff -Nru rust-parking-lot-0.10.2/debian/cargo-checksum.json rust-parking-lot-0.11.2/debian/cargo-checksum.json --- rust-parking-lot-0.10.2/debian/cargo-checksum.json 2021-11-30 17:57:33.000000000 +0000 +++ rust-parking-lot-0.11.2/debian/cargo-checksum.json 2021-12-30 09:53:42.000000000 +0000 @@ -1 +1 @@ -{"package":"d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e","files":{}} +{"package":"7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99","files":{}} diff -Nru rust-parking-lot-0.10.2/debian/changelog rust-parking-lot-0.11.2/debian/changelog --- rust-parking-lot-0.10.2/debian/changelog 2021-11-30 17:57:33.000000000 +0000 +++ rust-parking-lot-0.11.2/debian/changelog 2021-12-30 09:53:42.000000000 +0000 @@ -1,3 +1,9 @@ +rust-parking-lot (0.11.2-1) unstable; urgency=medium + + * Package parking_lot 0.11.2 from crates.io using debcargo 2.5.0 + + -- Sylvestre Ledru Thu, 30 Dec 2021 10:53:42 +0100 + rust-parking-lot (0.10.2-1) unstable; urgency=medium * Team upload. diff -Nru rust-parking-lot-0.10.2/debian/control rust-parking-lot-0.11.2/debian/control --- rust-parking-lot-0.10.2/debian/control 2021-11-30 17:57:33.000000000 +0000 +++ rust-parking-lot-0.11.2/debian/control 2021-12-30 09:53:42.000000000 +0000 @@ -6,8 +6,9 @@ cargo:native , rustc:native , libstd-rust-dev , - librust-lock-api-0.3+default-dev (>= 0.3.4-~~) , - librust-parking-lot-core-0.7+default-dev (>= 0.7.1-~~) + librust-instant-0.1+default-dev (>= 0.1.9-~~) , + librust-lock-api-0.4+default-dev (>= 0.4.5-~~) , + librust-parking-lot-core-0.8+default-dev (>= 0.8.4-~~) Maintainer: Debian Rust Maintainers Uploaders: Sylvestre Ledru , @@ -23,82 +24,57 @@ Multi-Arch: same Depends: ${misc:Depends}, - librust-lock-api-0.3+default-dev (>= 0.3.4-~~), - librust-parking-lot-core-0.7+default-dev (>= 0.7.1-~~) -Suggests: + librust-instant-0.1+default-dev (>= 0.1.9-~~), + librust-instant-0.1+stdweb-dev (>= 0.1.9-~~), + librust-instant-0.1+wasm-bindgen-dev (>= 0.1.9-~~), + librust-lock-api-0.4+arc-lock-dev (>= 0.4.5-~~), + librust-lock-api-0.4+default-dev (>= 0.4.5-~~), + librust-lock-api-0.4+nightly-dev (>= 0.4.5-~~), + librust-lock-api-0.4+owning-ref-dev (>= 0.4.5-~~), + librust-lock-api-0.4+serde-dev (>= 0.4.5-~~), + librust-parking-lot-core-0.8+deadlock-detection-dev (>= 0.8.4-~~), + librust-parking-lot-core-0.8+default-dev (>= 0.8.4-~~), + librust-parking-lot-core-0.8+nightly-dev (>= 0.8.4-~~) +Provides: + librust-parking-lot+arc-lock-dev (= ${binary:Version}), librust-parking-lot+deadlock-detection-dev (= ${binary:Version}), + librust-parking-lot+default-dev (= ${binary:Version}), librust-parking-lot+nightly-dev (= ${binary:Version}), librust-parking-lot+owning-ref-dev (= ${binary:Version}), - librust-parking-lot+serde-dev (= ${binary:Version}) -Provides: - librust-parking-lot+default-dev (= ${binary:Version}), + librust-parking-lot+send-guard-dev (= ${binary:Version}), + librust-parking-lot+serde-dev (= ${binary:Version}), + librust-parking-lot+stdweb-dev (= ${binary:Version}), + librust-parking-lot+wasm-bindgen-dev (= ${binary:Version}), librust-parking-lot-0-dev (= ${binary:Version}), - librust-parking-lot-0+default-dev (= ${binary:Version}), - librust-parking-lot-0.10-dev (= ${binary:Version}), - librust-parking-lot-0.10+default-dev (= ${binary:Version}), - librust-parking-lot-0.10.2-dev (= ${binary:Version}), - librust-parking-lot-0.10.2+default-dev (= ${binary:Version}) -Description: Compact, efficient std sync primitives - Rust source code - This package contains the source for the Rust parking_lot crate, packaged by - debcargo for use with cargo and dh-cargo. - -Package: librust-parking-lot+deadlock-detection-dev -Architecture: any -Multi-Arch: same -Depends: - ${misc:Depends}, - librust-parking-lot-dev (= ${binary:Version}), - librust-parking-lot-core-0.7+deadlock-detection-dev (>= 0.7.1-~~) -Provides: + librust-parking-lot-0+arc-lock-dev (= ${binary:Version}), librust-parking-lot-0+deadlock-detection-dev (= ${binary:Version}), - librust-parking-lot-0.10+deadlock-detection-dev (= ${binary:Version}), - librust-parking-lot-0.10.2+deadlock-detection-dev (= ${binary:Version}) -Description: Compact, efficient std sync primitives - feature "deadlock_detection" - This metapackage enables feature "deadlock_detection" for the Rust parking_lot - crate, by pulling in any additional dependencies needed by that feature. - -Package: librust-parking-lot+nightly-dev -Architecture: any -Multi-Arch: same -Depends: - ${misc:Depends}, - librust-parking-lot-dev (= ${binary:Version}), - librust-lock-api-0.3+nightly-dev (>= 0.3.4-~~), - librust-parking-lot-core-0.7+nightly-dev (>= 0.7.1-~~) -Provides: + librust-parking-lot-0+default-dev (= ${binary:Version}), librust-parking-lot-0+nightly-dev (= ${binary:Version}), - librust-parking-lot-0.10+nightly-dev (= ${binary:Version}), - librust-parking-lot-0.10.2+nightly-dev (= ${binary:Version}) -Description: Compact, efficient std sync primitives - feature "nightly" - This metapackage enables feature "nightly" for the Rust parking_lot crate, by - pulling in any additional dependencies needed by that feature. - -Package: librust-parking-lot+owning-ref-dev -Architecture: any -Multi-Arch: same -Depends: - ${misc:Depends}, - librust-parking-lot-dev (= ${binary:Version}), - librust-lock-api-0.3+owning-ref-dev (>= 0.3.4-~~) -Provides: librust-parking-lot-0+owning-ref-dev (= ${binary:Version}), - librust-parking-lot-0.10+owning-ref-dev (= ${binary:Version}), - librust-parking-lot-0.10.2+owning-ref-dev (= ${binary:Version}) -Description: Compact, efficient std sync primitives - feature "owning_ref" - This metapackage enables feature "owning_ref" for the Rust parking_lot crate, - by pulling in any additional dependencies needed by that feature. - -Package: librust-parking-lot+serde-dev -Architecture: any -Multi-Arch: same -Depends: - ${misc:Depends}, - librust-parking-lot-dev (= ${binary:Version}), - librust-lock-api-0.3+serde-dev (>= 0.3.4-~~) -Provides: + librust-parking-lot-0+send-guard-dev (= ${binary:Version}), librust-parking-lot-0+serde-dev (= ${binary:Version}), - librust-parking-lot-0.10+serde-dev (= ${binary:Version}), - librust-parking-lot-0.10.2+serde-dev (= ${binary:Version}) -Description: Compact, efficient std sync primitives - feature "serde" - This metapackage enables feature "serde" for the Rust parking_lot crate, by - pulling in any additional dependencies needed by that feature. + librust-parking-lot-0+stdweb-dev (= ${binary:Version}), + librust-parking-lot-0+wasm-bindgen-dev (= ${binary:Version}), + librust-parking-lot-0.11-dev (= ${binary:Version}), + librust-parking-lot-0.11+arc-lock-dev (= ${binary:Version}), + librust-parking-lot-0.11+deadlock-detection-dev (= ${binary:Version}), + librust-parking-lot-0.11+default-dev (= ${binary:Version}), + librust-parking-lot-0.11+nightly-dev (= ${binary:Version}), + librust-parking-lot-0.11+owning-ref-dev (= ${binary:Version}), + librust-parking-lot-0.11+send-guard-dev (= ${binary:Version}), + librust-parking-lot-0.11+serde-dev (= ${binary:Version}), + librust-parking-lot-0.11+stdweb-dev (= ${binary:Version}), + librust-parking-lot-0.11+wasm-bindgen-dev (= ${binary:Version}), + librust-parking-lot-0.11.2-dev (= ${binary:Version}), + librust-parking-lot-0.11.2+arc-lock-dev (= ${binary:Version}), + librust-parking-lot-0.11.2+deadlock-detection-dev (= ${binary:Version}), + librust-parking-lot-0.11.2+default-dev (= ${binary:Version}), + librust-parking-lot-0.11.2+nightly-dev (= ${binary:Version}), + librust-parking-lot-0.11.2+owning-ref-dev (= ${binary:Version}), + librust-parking-lot-0.11.2+send-guard-dev (= ${binary:Version}), + librust-parking-lot-0.11.2+serde-dev (= ${binary:Version}), + librust-parking-lot-0.11.2+stdweb-dev (= ${binary:Version}), + librust-parking-lot-0.11.2+wasm-bindgen-dev (= ${binary:Version}) +Description: Compact, efficient std sync primitives - Rust source code + This package contains the source for the Rust parking_lot crate, packaged by + debcargo for use with cargo and dh-cargo. diff -Nru rust-parking-lot-0.10.2/debian/debcargo.toml rust-parking-lot-0.11.2/debian/debcargo.toml --- rust-parking-lot-0.10.2/debian/debcargo.toml 2021-11-30 17:57:33.000000000 +0000 +++ rust-parking-lot-0.11.2/debian/debcargo.toml 2021-12-30 09:53:42.000000000 +0000 @@ -7,5 +7,7 @@ # The auto-generated summary is too long. summary = "Compact, efficient std sync primitives" +collapse_features = true + [packages."lib+nightly"] test_is_broken = true diff -Nru rust-parking-lot-0.10.2/debian/librust-parking-lot+deadlock-detection-dev.lintian-overrides rust-parking-lot-0.11.2/debian/librust-parking-lot+deadlock-detection-dev.lintian-overrides --- rust-parking-lot-0.10.2/debian/librust-parking-lot+deadlock-detection-dev.lintian-overrides 2021-11-30 17:57:33.000000000 +0000 +++ rust-parking-lot-0.11.2/debian/librust-parking-lot+deadlock-detection-dev.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -librust-parking-lot+deadlock-detection-dev binary: empty-rust-library-declares-provides * \ No newline at end of file diff -Nru rust-parking-lot-0.10.2/debian/librust-parking-lot+nightly-dev.lintian-overrides rust-parking-lot-0.11.2/debian/librust-parking-lot+nightly-dev.lintian-overrides --- rust-parking-lot-0.10.2/debian/librust-parking-lot+nightly-dev.lintian-overrides 2021-11-30 17:57:33.000000000 +0000 +++ rust-parking-lot-0.11.2/debian/librust-parking-lot+nightly-dev.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -librust-parking-lot+nightly-dev binary: empty-rust-library-declares-provides * \ No newline at end of file diff -Nru rust-parking-lot-0.10.2/debian/librust-parking-lot+owning-ref-dev.lintian-overrides rust-parking-lot-0.11.2/debian/librust-parking-lot+owning-ref-dev.lintian-overrides --- rust-parking-lot-0.10.2/debian/librust-parking-lot+owning-ref-dev.lintian-overrides 2021-11-30 17:57:33.000000000 +0000 +++ rust-parking-lot-0.11.2/debian/librust-parking-lot+owning-ref-dev.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -librust-parking-lot+owning-ref-dev binary: empty-rust-library-declares-provides * \ No newline at end of file diff -Nru rust-parking-lot-0.10.2/debian/librust-parking-lot+serde-dev.lintian-overrides rust-parking-lot-0.11.2/debian/librust-parking-lot+serde-dev.lintian-overrides --- rust-parking-lot-0.10.2/debian/librust-parking-lot+serde-dev.lintian-overrides 2021-11-30 17:57:33.000000000 +0000 +++ rust-parking-lot-0.11.2/debian/librust-parking-lot+serde-dev.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -librust-parking-lot+serde-dev binary: empty-rust-library-declares-provides * \ No newline at end of file diff -Nru rust-parking-lot-0.10.2/debian/tests/control rust-parking-lot-0.11.2/debian/tests/control --- rust-parking-lot-0.10.2/debian/tests/control 2021-11-30 17:57:33.000000000 +0000 +++ rust-parking-lot-0.11.2/debian/tests/control 2021-12-30 09:53:42.000000000 +0000 @@ -1,34 +1,54 @@ -Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.10.2 --all-targets --all-features +Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.11.2 --all-targets --all-features Features: test-name=rust-parking-lot:@ -Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.1.3-~~), librust-rand-0.7+default-dev, @ +Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.3.3-~~), librust-rand-0.8+default-dev (>= 0.8.3-~~), @ Restrictions: allow-stderr, skip-not-installable, flaky -Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.10.2 --all-targets -Features: test-name=librust-parking-lot-dev:default -Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.1.3-~~), librust-rand-0.7+default-dev, @ +Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.11.2 --all-targets --no-default-features --features arc_lock +Features: test-name=librust-parking-lot-dev:arc_lock +Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.3.3-~~), librust-rand-0.8+default-dev (>= 0.8.3-~~), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.10.2 --all-targets --no-default-features -Features: test-name=librust-parking-lot-dev: -Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.1.3-~~), librust-rand-0.7+default-dev, @ +Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.11.2 --all-targets --no-default-features --features deadlock_detection +Features: test-name=librust-parking-lot-dev:deadlock_detection +Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.3.3-~~), librust-rand-0.8+default-dev (>= 0.8.3-~~), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.10.2 --all-targets --no-default-features --features deadlock_detection -Features: test-name=librust-parking-lot+deadlock-detection-dev:deadlock_detection -Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.1.3-~~), librust-rand-0.7+default-dev, @ +Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.11.2 --all-targets +Features: test-name=librust-parking-lot-dev:default +Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.3.3-~~), librust-rand-0.8+default-dev (>= 0.8.3-~~), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.10.2 --all-targets --no-default-features --features nightly -Features: test-name=librust-parking-lot+nightly-dev:nightly -Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.1.3-~~), librust-rand-0.7+default-dev, @ +Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.11.2 --all-targets --no-default-features --features nightly +Features: test-name=librust-parking-lot-dev:nightly +Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.3.3-~~), librust-rand-0.8+default-dev (>= 0.8.3-~~), @ Restrictions: allow-stderr, skip-not-installable, flaky -Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.10.2 --all-targets --no-default-features --features owning_ref -Features: test-name=librust-parking-lot+owning-ref-dev:owning_ref -Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.1.3-~~), librust-rand-0.7+default-dev, @ +Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.11.2 --all-targets --no-default-features --features owning_ref +Features: test-name=librust-parking-lot-dev:owning_ref +Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.3.3-~~), librust-rand-0.8+default-dev (>= 0.8.3-~~), @ +Restrictions: allow-stderr, skip-not-installable + +Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.11.2 --all-targets --no-default-features --features send_guard +Features: test-name=librust-parking-lot-dev:send_guard +Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.3.3-~~), librust-rand-0.8+default-dev (>= 0.8.3-~~), @ +Restrictions: allow-stderr, skip-not-installable + +Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.11.2 --all-targets --no-default-features --features serde +Features: test-name=librust-parking-lot-dev:serde +Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.3.3-~~), librust-rand-0.8+default-dev (>= 0.8.3-~~), @ +Restrictions: allow-stderr, skip-not-installable + +Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.11.2 --all-targets --no-default-features --features stdweb +Features: test-name=librust-parking-lot-dev:stdweb +Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.3.3-~~), librust-rand-0.8+default-dev (>= 0.8.3-~~), @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.10.2 --all-targets --no-default-features --features serde -Features: test-name=librust-parking-lot+serde-dev:serde -Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.1.3-~~), librust-rand-0.7+default-dev, @ +Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.11.2 --all-targets --no-default-features --features wasm-bindgen +Features: test-name=librust-parking-lot-dev:wasm-bindgen +Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.3.3-~~), librust-rand-0.8+default-dev (>= 0.8.3-~~), @ +Restrictions: allow-stderr, skip-not-installable + +Test-Command: /usr/share/cargo/bin/cargo-auto-test parking_lot 0.11.2 --all-targets --no-default-features +Features: test-name=librust-parking-lot-dev: +Depends: dh-cargo (>= 18), librust-bincode-1+default-dev (>= 1.3.3-~~), librust-rand-0.8+default-dev (>= 0.8.3-~~), @ Restrictions: allow-stderr, skip-not-installable diff -Nru rust-parking-lot-0.10.2/.github/workflows/rust.yml rust-parking-lot-0.11.2/.github/workflows/rust.yml --- rust-parking-lot-0.10.2/.github/workflows/rust.yml 1970-01-01 00:00:00.000000000 +0000 +++ rust-parking-lot-0.11.2/.github/workflows/rust.yml 1973-11-29 21:33:09.000000000 +0000 @@ -0,0 +1,65 @@ +name: Rust + +on: + push: + branches-ignore: + - trying.tmp + - staging.tmp + pull_request: + +env: + RUST_TEST_THREADS: 1 + +jobs: + build_tier_one: + runs-on: ${{ matrix.os }}-latest + strategy: + matrix: + os: [ubuntu, macos, windows] + channel: [1.49.0, stable, beta, nightly] + feature: [arc_lock, serde, deadlock_detection] + exclude: + - feature: deadlock_detection + channel: '1.49.0' + include: + - channel: nightly + feature: nightly + os: ubuntu + + steps: + - uses: actions/checkout@v2 + - run: rustup default ${{ matrix.channel }} + - run: cargo build --all + - run: cargo test --all + - run: cargo build --all --features ${{ matrix.feature }} + - run: cargo test --all --features ${{ matrix.feature }} + if: matrix.feature == 'nightly' + build_other_platforms: + runs-on: ubuntu-latest + strategy: + matrix: + target: + - wasm32-unknown-unknown + - x86_64-fortanix-unknown-sgx + #- x86_64-unknown-redox + #- x86_64-linux-android + steps: + - uses: actions/checkout@v2 + - run: rustup default nightly + - run: rustup target add ${{ matrix.target }} + - run: cargo build --workspace --target ${{ matrix.target }} --features nightly + build_docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: rustup default nightly + - run: cargo doc --workspace --features arc_lock,serde,deadlock_detection --no-deps -p parking_lot -p parking_lot_core -p lock_api + benchmark: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: rustup default nightly + - run: | + cd benchmark + cargo run --release --bin mutex -- 2 1 0 1 2 + cargo run --release --bin rwlock -- 1 1 1 0 1 2 diff -Nru rust-parking-lot-0.10.2/README.md rust-parking-lot-0.11.2/README.md --- rust-parking-lot-0.10.2/README.md 2020-04-06 16:49:16.000000000 +0000 +++ rust-parking-lot-0.11.2/README.md 1973-11-29 21:33:09.000000000 +0000 @@ -1,7 +1,8 @@ parking_lot ============ -[![Build Status](https://travis-ci.org/Amanieu/parking_lot.svg?branch=master)](https://travis-ci.org/Amanieu/parking_lot) [![Build status](https://ci.appveyor.com/api/projects/status/wppcc32ttpud0a30/branch/master?svg=true)](https://ci.appveyor.com/project/Amanieu/parking-lot/branch/master) [![Crates.io](https://img.shields.io/crates/v/parking_lot.svg)](https://crates.io/crates/parking_lot) +![Rust](https://github.com/Amanieu/parking_lot/workflows/Rust/badge.svg) +[![Crates.io](https://img.shields.io/crates/v/parking_lot.svg)](https://crates.io/crates/parking_lot) [Documentation (synchronization primitives)](https://docs.rs/parking_lot/) @@ -71,6 +72,8 @@ 18. Optional support for [serde](https://docs.serde.rs/serde/). Enable via the feature `serde`. **NOTE!** this support is for `Mutex`, `ReentrantMutex`, and `RwLock` only; `Condvar` and `Once` are not currently supported. +19. Lock guards can be sent to other threads when the `send_guard` feature is + enabled. ## The parking lot @@ -92,6 +95,8 @@ does not work on stable Rust yet. - `RwLock` will not be able to take advantage of hardware lock elision for readers, which improves performance when there are multiple readers. +- The `wasm32-unknown-unknown` target is only supported on nightly and requires + `-C target-feature=+atomics` in `RUSTFLAGS`. To enable nightly-only functionality, you need to enable the `nightly` feature in Cargo (see below). @@ -102,19 +107,25 @@ ```toml [dependencies] -parking_lot = "0.10" +parking_lot = "0.11" ``` To enable nightly-only features, add this to your `Cargo.toml` instead: ```toml [dependencies] -parking_lot = { version = "0.10", features = ["nightly"] } +parking_lot = { version = "0.11", features = ["nightly"] } ``` The experimental deadlock detector can be enabled with the `deadlock_detection` Cargo feature. +To allow sending `MutexGuard`s and `RwLock*Guard`s to other threads, enable the +`send_guard` option. + +Note that the `deadlock_detection` and `send_guard` features are incompatible +and cannot be used together. + The core parking lot API is provided by the `parking_lot_core` crate. It is separate from the synchronization primitives in the `parking_lot` crate so that changes to the core API do not cause breaking changes for users of `parking_lot`. diff -Nru rust-parking-lot-0.10.2/src/condvar.rs rust-parking-lot-0.11.2/src/condvar.rs --- rust-parking-lot-0.10.2/src/condvar.rs 2020-04-06 16:49:16.000000000 +0000 +++ rust-parking-lot-0.11.2/src/condvar.rs 1973-11-29 21:33:09.000000000 +0000 @@ -12,9 +12,10 @@ fmt, ptr, sync::atomic::{AtomicPtr, Ordering}, }; +use instant::Instant; use lock_api::RawMutex as RawMutex_; use parking_lot_core::{self, ParkResult, RequeueOp, UnparkResult, DEFAULT_PARK_TOKEN}; -use std::time::{Duration, Instant}; +use std::time::Duration; /// A type indicating whether a timed wait on a condition variable returned /// due to a time out or not. @@ -413,10 +414,11 @@ #[cfg(test)] mod tests { use crate::{Condvar, Mutex, MutexGuard}; + use instant::Instant; use std::sync::mpsc::channel; use std::sync::Arc; use std::thread; - use std::time::{Duration, Instant}; + use std::time::Duration; #[test] fn smoke() { @@ -661,6 +663,9 @@ while !c.notify_one() { // Wait for the thread to get into wait() MutexGuard::bump(&mut g); + // Yield, so the other thread gets a chance to do something. + // (At least Miri needs this, because it doesn't preempt threads.) + thread::yield_now(); } // The thread should have been requeued to the mutex, which we wake up now. drop(g); diff -Nru rust-parking-lot-0.10.2/src/lib.rs rust-parking-lot-0.11.2/src/lib.rs --- rust-parking-lot-0.10.2/src/lib.rs 2020-04-10 13:50:06.000000000 +0000 +++ rust-parking-lot-0.11.2/src/lib.rs 1973-11-29 21:33:09.000000000 +0000 @@ -30,6 +30,15 @@ #[cfg(not(feature = "deadlock_detection"))] mod deadlock; +// If deadlock detection is enabled, we cannot allow lock guards to be sent to +// other threads. +#[cfg(all(feature = "send_guard", feature = "deadlock_detection"))] +compile_error!("the `send_guard` and `deadlock_detection` features cannot be used together"); +#[cfg(feature = "send_guard")] +type GuardMarker = lock_api::GuardSend; +#[cfg(not(feature = "send_guard"))] +type GuardMarker = lock_api::GuardNoSend; + pub use self::condvar::{Condvar, WaitTimeoutResult}; pub use self::fair_mutex::{const_fair_mutex, FairMutex, FairMutexGuard, MappedFairMutexGuard}; pub use self::mutex::{const_mutex, MappedMutexGuard, Mutex, MutexGuard}; diff -Nru rust-parking-lot-0.10.2/src/mutex.rs rust-parking-lot-0.11.2/src/mutex.rs --- rust-parking-lot-0.10.2/src/mutex.rs 2020-04-06 16:49:16.000000000 +0000 +++ rust-parking-lot-0.11.2/src/mutex.rs 1973-11-29 21:33:09.000000000 +0000 @@ -21,18 +21,18 @@ /// /// A typical unfair lock can often end up in a situation where a single thread /// quickly acquires and releases the same mutex in succession, which can starve -/// other threads waiting to acquire the mutex. While this improves performance +/// other threads waiting to acquire the mutex. While this improves throughput /// because it doesn't force a context switch when a thread tries to re-acquire /// a mutex it has just released, this can starve other threads. /// /// This mutex uses [eventual fairness](https://trac.webkit.org/changeset/203350) /// to ensure that the lock will be fair on average without sacrificing -/// performance. This is done by forcing a fair unlock on average every 0.5ms, +/// throughput. This is done by forcing a fair unlock on average every 0.5ms, /// which will force the lock to go to the next thread waiting for the mutex. /// /// Additionally, any critical section longer than 1ms will always use a fair -/// unlock, which has a negligible performance impact compared to the length of -/// the critical section. +/// unlock, which has a negligible impact on throughput considering the length +/// of the critical section. /// /// You can also force a fair unlock by calling `MutexGuard::unlock_fair` when /// unlocking a mutex instead of simply dropping the `MutexGuard`. diff -Nru rust-parking-lot-0.10.2/src/raw_fair_mutex.rs rust-parking-lot-0.11.2/src/raw_fair_mutex.rs --- rust-parking-lot-0.10.2/src/raw_fair_mutex.rs 2020-04-06 16:49:16.000000000 +0000 +++ rust-parking-lot-0.11.2/src/raw_fair_mutex.rs 1973-11-29 21:33:09.000000000 +0000 @@ -27,19 +27,24 @@ } #[inline] - fn unlock(&self) { + unsafe fn unlock(&self) { self.unlock_fair() } + + #[inline] + fn is_locked(&self) -> bool { + self.0.is_locked() + } } unsafe impl lock_api::RawMutexFair for RawFairMutex { #[inline] - fn unlock_fair(&self) { + unsafe fn unlock_fair(&self) { self.0.unlock_fair() } #[inline] - fn bump(&self) { + unsafe fn bump(&self) { self.0.bump() } } diff -Nru rust-parking-lot-0.10.2/src/raw_mutex.rs rust-parking-lot-0.11.2/src/raw_mutex.rs --- rust-parking-lot-0.10.2/src/raw_mutex.rs 2019-11-24 22:05:57.000000000 +0000 +++ rust-parking-lot-0.11.2/src/raw_mutex.rs 1973-11-29 21:33:09.000000000 +0000 @@ -10,9 +10,9 @@ sync::atomic::{AtomicU8, Ordering}, time::Duration, }; -use lock_api::{GuardNoSend, RawMutex as RawMutex_}; +use instant::Instant; +use lock_api::RawMutex as RawMutex_; use parking_lot_core::{self, ParkResult, SpinWait, UnparkResult, UnparkToken, DEFAULT_PARK_TOKEN}; -use std::time::Instant; // UnparkToken used to indicate that that the target thread should attempt to // lock the mutex again as soon as it is unparked. @@ -60,7 +60,7 @@ state: AtomicU8::new(0), }; - type GuardMarker = GuardNoSend; + type GuardMarker = crate::GuardMarker; #[inline] fn lock(&self) { @@ -97,8 +97,8 @@ } #[inline] - fn unlock(&self) { - unsafe { deadlock::release_resource(self as *const _ as usize) }; + unsafe fn unlock(&self) { + deadlock::release_resource(self as *const _ as usize); if self .state .compare_exchange(LOCKED_BIT, 0, Ordering::Release, Ordering::Relaxed) @@ -108,12 +108,18 @@ } self.unlock_slow(false); } + + #[inline] + fn is_locked(&self) -> bool { + let state = self.state.load(Ordering::Relaxed); + state & LOCKED_BIT != 0 + } } unsafe impl lock_api::RawMutexFair for RawMutex { #[inline] - fn unlock_fair(&self) { - unsafe { deadlock::release_resource(self as *const _ as usize) }; + unsafe fn unlock_fair(&self) { + deadlock::release_resource(self as *const _ as usize); if self .state .compare_exchange(LOCKED_BIT, 0, Ordering::Release, Ordering::Relaxed) @@ -125,7 +131,7 @@ } #[inline] - fn bump(&self) { + unsafe fn bump(&self) { if self.state.load(Ordering::Relaxed) & PARKED_BIT != 0 { self.bump_slow(); } diff -Nru rust-parking-lot-0.10.2/src/raw_rwlock.rs rust-parking-lot-0.11.2/src/raw_rwlock.rs --- rust-parking-lot-0.10.2/src/raw_rwlock.rs 2019-11-24 22:05:57.000000000 +0000 +++ rust-parking-lot-0.11.2/src/raw_rwlock.rs 1973-11-29 21:33:09.000000000 +0000 @@ -12,11 +12,12 @@ cell::Cell, sync::atomic::{AtomicUsize, Ordering}, }; -use lock_api::{GuardNoSend, RawRwLock as RawRwLock_, RawRwLockUpgrade}; +use instant::Instant; +use lock_api::{RawRwLock as RawRwLock_, RawRwLockUpgrade}; use parking_lot_core::{ self, deadlock, FilterOp, ParkResult, ParkToken, SpinWait, UnparkResult, UnparkToken, }; -use std::time::{Duration, Instant}; +use std::time::Duration; // This reader-writer lock implementation is based on Boost's upgrade_mutex: // https://github.com/boostorg/thread/blob/fc08c1fe2840baeeee143440fba31ef9e9a813c8/include/boost/thread/v2/shared_mutex.hpp#L432 @@ -61,7 +62,7 @@ state: AtomicUsize::new(0), }; - type GuardMarker = GuardNoSend; + type GuardMarker = crate::GuardMarker; #[inline] fn lock_exclusive(&self) { @@ -91,7 +92,7 @@ } #[inline] - fn unlock_exclusive(&self) { + unsafe fn unlock_exclusive(&self) { self.deadlock_release(); if self .state @@ -126,7 +127,7 @@ } #[inline] - fn unlock_shared(&self) { + unsafe fn unlock_shared(&self) { self.deadlock_release(); let state = if have_elision() { self.state.elision_fetch_sub_release(ONE_READER) @@ -137,17 +138,23 @@ self.unlock_shared_slow(); } } + + #[inline] + fn is_locked(&self) -> bool { + let state = self.state.load(Ordering::Relaxed); + state & (WRITER_BIT | READERS_MASK) != 0 + } } unsafe impl lock_api::RawRwLockFair for RawRwLock { #[inline] - fn unlock_shared_fair(&self) { + unsafe fn unlock_shared_fair(&self) { // Shared unlocking is always fair in this implementation. self.unlock_shared(); } #[inline] - fn unlock_exclusive_fair(&self) { + unsafe fn unlock_exclusive_fair(&self) { self.deadlock_release(); if self .state @@ -160,7 +167,7 @@ } #[inline] - fn bump_shared(&self) { + unsafe fn bump_shared(&self) { if self.state.load(Ordering::Relaxed) & (READERS_MASK | WRITER_BIT) == ONE_READER | WRITER_BIT { @@ -169,7 +176,7 @@ } #[inline] - fn bump_exclusive(&self) { + unsafe fn bump_exclusive(&self) { if self.state.load(Ordering::Relaxed) & PARKED_BIT != 0 { self.bump_exclusive_slow(); } @@ -178,7 +185,7 @@ unsafe impl lock_api::RawRwLockDowngrade for RawRwLock { #[inline] - fn downgrade(&self) { + unsafe fn downgrade(&self) { let state = self .state .fetch_add(ONE_READER - WRITER_BIT, Ordering::Release); @@ -331,7 +338,7 @@ } #[inline] - fn unlock_upgradable(&self) { + unsafe fn unlock_upgradable(&self) { self.deadlock_release(); let state = self.state.load(Ordering::Relaxed); if state & PARKED_BIT == 0 { @@ -352,10 +359,10 @@ } #[inline] - fn upgrade(&self) { + unsafe fn upgrade(&self) { let state = self.state.fetch_sub( (ONE_READER | UPGRADABLE_BIT) - WRITER_BIT, - Ordering::Relaxed, + Ordering::Acquire, ); if state & READERS_MASK != ONE_READER { let result = self.upgrade_slow(None); @@ -364,13 +371,13 @@ } #[inline] - fn try_upgrade(&self) -> bool { + unsafe fn try_upgrade(&self) -> bool { if self .state .compare_exchange_weak( ONE_READER | UPGRADABLE_BIT, WRITER_BIT, - Ordering::Relaxed, + Ordering::Acquire, Ordering::Relaxed, ) .is_ok() @@ -384,7 +391,7 @@ unsafe impl lock_api::RawRwLockUpgradeFair for RawRwLock { #[inline] - fn unlock_upgradable_fair(&self) { + unsafe fn unlock_upgradable_fair(&self) { self.deadlock_release(); let state = self.state.load(Ordering::Relaxed); if state & PARKED_BIT == 0 { @@ -405,7 +412,7 @@ } #[inline] - fn bump_upgradable(&self) { + unsafe fn bump_upgradable(&self) { if self.state.load(Ordering::Relaxed) == ONE_READER | UPGRADABLE_BIT | PARKED_BIT { self.bump_upgradable_slow(); } @@ -414,7 +421,7 @@ unsafe impl lock_api::RawRwLockUpgradeDowngrade for RawRwLock { #[inline] - fn downgrade_upgradable(&self) { + unsafe fn downgrade_upgradable(&self) { let state = self.state.fetch_sub(UPGRADABLE_BIT, Ordering::Relaxed); // Wake up parked upgradable threads if there are any @@ -424,7 +431,7 @@ } #[inline] - fn downgrade_to_upgradable(&self) { + unsafe fn downgrade_to_upgradable(&self) { let state = self.state.fetch_add( (ONE_READER | UPGRADABLE_BIT) - WRITER_BIT, Ordering::Release, @@ -465,7 +472,7 @@ } #[inline] - fn try_upgrade_until(&self, timeout: Instant) -> bool { + unsafe fn try_upgrade_until(&self, timeout: Instant) -> bool { let state = self.state.fetch_sub( (ONE_READER | UPGRADABLE_BIT) - WRITER_BIT, Ordering::Relaxed, @@ -478,7 +485,7 @@ } #[inline] - fn try_upgrade_for(&self, timeout: Duration) -> bool { + unsafe fn try_upgrade_for(&self, timeout: Duration) -> bool { let state = self.state.fetch_sub( (ONE_READER | UPGRADABLE_BIT) - WRITER_BIT, Ordering::Relaxed, @@ -892,7 +899,7 @@ } #[cold] - fn bump_shared_slow(&self) { + unsafe fn bump_shared_slow(&self) { self.unlock_shared(); self.lock_shared(); } @@ -963,11 +970,11 @@ // At this point WRITER_BIT is already set, we just need to wait for the // remaining readers to exit the lock. let mut spinwait = SpinWait::new(); - let mut state = self.state.load(Ordering::Relaxed); + let mut state = self.state.load(Ordering::Acquire); while state & READERS_MASK != 0 { // Spin a few times to wait for readers to exit if spinwait.spin() { - state = self.state.load(Ordering::Relaxed); + state = self.state.load(Ordering::Acquire); continue; } @@ -1012,7 +1019,7 @@ // since a previous writer timing-out could have allowed // another reader to sneak in before we parked. ParkResult::Unparked(_) | ParkResult::Invalid => { - state = self.state.load(Ordering::Relaxed); + state = self.state.load(Ordering::Acquire); continue; } diff -Nru rust-parking-lot-0.10.2/src/rwlock.rs rust-parking-lot-0.11.2/src/rwlock.rs --- rust-parking-lot-0.10.2/src/rwlock.rs 2020-04-06 16:49:16.000000000 +0000 +++ rust-parking-lot-0.11.2/src/rwlock.rs 1973-11-29 21:33:09.000000000 +0000 @@ -31,18 +31,18 @@ /// /// A typical unfair lock can often end up in a situation where a single thread /// quickly acquires and releases the same lock in succession, which can starve -/// other threads waiting to acquire the rwlock. While this improves performance +/// other threads waiting to acquire the rwlock. While this improves throughput /// because it doesn't force a context switch when a thread tries to re-acquire /// a rwlock it has just released, this can starve other threads. /// /// This rwlock uses [eventual fairness](https://trac.webkit.org/changeset/203350) /// to ensure that the lock will be fair on average without sacrificing -/// performance. This is done by forcing a fair unlock on average every 0.5ms, +/// throughput. This is done by forcing a fair unlock on average every 0.5ms, /// which will force the lock to go to the next thread waiting for the rwlock. /// /// Additionally, any critical section longer than 1ms will always use a fair -/// unlock, which has a negligible performance impact compared to the length of -/// the critical section. +/// unlock, which has a negligible impact on throughput considering the length +/// of the critical section. /// /// You can also force a fair unlock by calling `RwLockReadGuard::unlock_fair` /// or `RwLockWriteGuard::unlock_fair` when unlocking a mutex instead of simply @@ -539,8 +539,8 @@ fn test_rwlock_recursive() { let arc = Arc::new(RwLock::new(1)); let arc2 = arc.clone(); - let _lock1 = arc.read(); - thread::spawn(move || { + let lock1 = arc.read(); + let t = thread::spawn(move || { let _lock = arc2.write(); }); @@ -554,7 +554,12 @@ } // A normal read would block here since there is a pending writer - let _lock2 = arc.read_recursive(); + let lock2 = arc.read_recursive(); + + // Unblock the thread and join it. + drop(lock1); + drop(lock2); + t.join().unwrap(); } #[test] diff -Nru rust-parking-lot-0.10.2/src/util.rs rust-parking-lot-0.11.2/src/util.rs --- rust-parking-lot-0.10.2/src/util.rs 2019-11-24 22:05:57.000000000 +0000 +++ rust-parking-lot-0.11.2/src/util.rs 1973-11-29 21:33:09.000000000 +0000 @@ -5,7 +5,8 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. -use std::time::{Duration, Instant}; +use instant::Instant; +use std::time::Duration; // Option::unchecked_unwrap pub trait UncheckedOptionExt { diff -Nru rust-parking-lot-0.10.2/.travis.yml rust-parking-lot-0.11.2/.travis.yml --- rust-parking-lot-0.10.2/.travis.yml 2020-04-10 13:50:06.000000000 +0000 +++ rust-parking-lot-0.11.2/.travis.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -language: rust -sudo: false - -env: - global: - - RUST_TEST_THREADS=1 - -matrix: - include: - - rust: 1.36.0 - os: linux - script: - - cargo build --lib - - cargo build --lib --features serde - # Build on other platforms - - rustup target add wasm32-unknown-unknown - - cargo build --lib --target wasm32-unknown-unknown - - - rust: 1.36.0 - os: linux - script: &script - - cargo build - - cargo test --all - - cargo build --features serde - - cargo test --features serde - - cargo test --features=deadlock_detection - # Test other platforms - - rustup target add wasm32-unknown-unknown - - cargo build --all --target wasm32-unknown-unknown - - - rust: stable - os: linux - script: *script - - - rust: beta - os: linux - script: *script - - - rust: nightly - os: linux - script: - - cargo build --features nightly - - cargo test --all --features nightly - - cargo build --features serde,nightly - - cargo test --all --features serde,nightly - # Test other platforms - - rustup target add x86_64-fortanix-unknown-sgx - - rustup target add x86_64-unknown-redox - - rustup target add x86_64-unknown-cloudabi - - rustup target add x86_64-linux-android - - cargo test --all --no-run --target x86_64-fortanix-unknown-sgx --features nightly - - cargo build --all --target x86_64-unknown-redox --features nightly - - cargo build --all --target x86_64-unknown-cloudabi --features nightly - - cargo build --all --target x86_64-linux-android --features nightly - # Test building the docs - - cargo doc --all-features --no-deps -p parking_lot -p parking_lot_core -p lock_api - # Run the benchmarks - - cd benchmark - - cargo run --release --bin mutex -- 2 1 0 1 2 - - cargo run --release --bin rwlock -- 1 1 1 0 1 2 - - cd .. - - - rust: 1.36.0 - os: osx - script: *script - - - rust: stable - os: osx - script: *script - - - rust: beta - os: osx - script: *script - - - rust: nightly - os: osx - script: - - cargo build --features nightly - - cargo test --all --features nightly - - cargo build --features serde,nightly - - cargo test --all --features serde,nightly - -notifications: - email: false - -branches: - # Don't build these branches - except: - # Used by bors - - trying.tmp - - staging.tmp