749 Commits

Author SHA1 Message Date
Paulo a3b7af78d0 Fix FairMutex debug 2020-01-06 16:15:51 -03:00
Paulo 759a2cce08 Remove condvar test 2020-01-06 15:15:56 -03:00
Paulo 5155206f09 Create API for mutex that is always fair 2020-01-06 15:06:16 -03:00
zhangli.pear 6ad6cd70c9 fix: not panic in destructor 2020-01-07 00:09:56 +08:00
Amanieu d'Antras a3723ce71f Bump lock_api version to 0.3.3 2020-01-04 11:53:34 +01:00
Amanieu d'Antras 107f49525c Mark MappedRwLockWriteGuard::downgrade as deprecated
See #198
2020-01-04 11:53:34 +01:00
bors[bot] 6088c9d60a Merge #196
196: Fixed typo in changelog r=faern a=TheDan64



Co-authored-by: Daniel Kolsoi <thadan64@gmail.com>
2019-11-27 07:49:16 +00:00
Daniel Kolsoi b8161352ee Fixed typo in changelog 2019-11-26 20:52:01 -05:00
bors[bot] ba0a3e1e38 Merge #195
195: Remove rust2015 style docs r=Amanieu a=faern

We juuuust had a release. But when sifting through the docs I stumbled upon a `extern crate parking_lot;`. That felt very ancient. So I removed it.

I also found an example with `use` statements that were not sorted. So very minor, but could fix it while I was at it anyway.

Co-authored-by: Linus Färnstrand <faern@faern.net>
2019-11-25 23:46:00 +00:00
Linus Färnstrand f9de89f2d1 Sort use statements alphabetically in example 2019-11-25 22:54:31 +01:00
Linus Färnstrand 5a5c5da112 Remove usage of extern crate in README 2019-11-25 22:51:29 +01:00
bors[bot] bd3187ab27 Merge #194
194: Add changelog entries and bump versions for 0.10.0 release r=Amanieu a=faern

We must first let #193 be merged. Otherwise this changelog is not even correct.

There were a lot of changes since last release. But the vast majority is reformatting and re-arranging to reduce the number of unsafe expressions. As well as adding safety invariant documentation and a few tests. These are cool improvements, but does not affect the public API. I can add something about it in the changelog if you think it's worth it.

`lock_api` only has formatting changes and a few documentation improvements, so I don't think it needs a breaking version change. But might be worth releasing anyway to get the improved documentation out.

The date in the changelog is simply tomorrow. Since I did not think we would have time to release today, and I did not want to just go with `2019-XX-YY` either. If we don't think we'll release tomorrow we can just fix that before merging this PR.

Co-authored-by: Linus Färnstrand <faern@faern.net>
2019-11-25 20:15:22 +00:00
Linus Färnstrand f81a0ef849 Bump version in usage docs 2019-11-25 20:09:08 +01:00
Linus Färnstrand fc87375c43 checked_duration_since is stable. Remove from feature gate 2019-11-25 19:53:58 +01:00
Linus Färnstrand 81497ca85a Update docs with what works on stable 2019-11-25 19:48:42 +01:00
Linus Färnstrand 8840d35a46 Add changelog entries and bump versions for 0.10.0 release 2019-11-25 19:48:42 +01:00
bors[bot] 60b4a77b42 Merge #193
193: Misc clippy fixes r=Amanieu a=faern

I went over the crates with Clippy. Some suggested changes are only stylistic, others more optimization oriented. The commit messages should hopefully explain well enough why each change was made. Otherwise see what clippy says on current master :)

I left some warnings, since the suggested changes were not really objectively better, or possibly larger than what I wanted to do right now.

Co-authored-by: Linus Färnstrand <faern@faern.net>
2019-11-24 21:33:39 +00:00
Linus Färnstrand e19ec66739 Remove unused autocfg dependency
Usage of this was removed in commit 84c7033 PR #189
2019-11-24 22:02:42 +01:00
Linus Färnstrand a53fbc6174 Test with integer instead of unit type
Clippy complained that:
`assert_eq` of unit values detected. This will always succeed
2019-11-24 21:42:30 +01:00
Linus Färnstrand 92759f6559 Remove let binding for Condition::wait unit return type 2019-11-24 21:40:33 +01:00
Linus Färnstrand 426d170d9c Remove superfluous unit return type from closures 2019-11-24 21:40:05 +01:00
Linus Färnstrand 691d2e5e3b Add visual separators to large numbers 2019-11-24 21:39:44 +01:00
Linus Färnstrand cba3e51416 Make methods on tiny copy types take ownership instead of reference 2019-11-24 21:39:23 +01:00
bors[bot] 9bbab4b687 Merge #192
192: Add integration tests for Condvar r=Amanieu a=pinkisemils

As discussed during Impl days, I've gone and pretty much verbatim copied WebKit's `Condvar` tests here.

Co-authored-by: Emīls Piņķis <emils@mullvad.net>
Co-authored-by: Emīls <pinkisemils@mullvad.net>
2019-11-24 14:52:51 +00:00
Emīls ca016fed38 Specify tests with a macro 2019-11-22 16:06:45 +00:00
Emīls 0ed7ce39f8 Move Queue test into it's own module 2019-11-22 14:06:08 +00:00
Emīls Piņķis e2c43239b4 Add integration tests for Condvar 2019-11-21 22:50:35 +00:00
bors[bot] 755c522bf8 Merge #191
191: Add initial parking_lot_core tests r=Amanieu a=faern

This library could use more tests, to be more robust. This was one of the things pointed out in the review of the integration into std in https://github.com/rust-lang/rust/pull/56410

`WTF::ParkingLot` has a number of tests we can take inspiration from. And this is somewhat of a port of some of those tests. However, when I ported it 1:1 I found a race condition, so I had to implement the semaphore a bit differently.

I also got away without the tests relying on a working mutex or condvar implementation. Because we can't make the `parking_lot_core` tests depend on the higher level `parking_lot`, nor do we want to depend on locking primitives in std if we aim to become the base for those implementations one day.

Co-authored-by: Linus Färnstrand <faern@faern.net>
2019-11-16 14:45:35 +00:00
Linus Färnstrand 714d1bf1b6 Reformat tests to be <=100 chars wide 2019-11-16 15:14:23 +01:00
Linus Färnstrand a7893903c7 Implement test without relying on std Mutex/Condvar 2019-11-16 15:05:15 +01:00
Linus Färnstrand 28ba89362b Add parking_lot_core tests inspired by WTF::ParkingLot 2019-11-16 15:04:48 +01:00
bors[bot] b187f9bba6 Merge #189
189: Remove pre 1.36 backwards compatibility code r=Amanieu a=faern

Back when I submitted #185 I did not get the impression that dropping support for older Rust was an option. But it seemed to have gone through without much fanfare in #188, so I guess we can remove all this backwards compatibility code now then.

Co-authored-by: Linus Färnstrand <faern@faern.net>
2019-11-05 21:00:43 +00:00
Linus Färnstrand 84c703395b Remove pre 1.36 backwards compatibility code 2019-11-05 21:37:32 +01:00
bors[bot] a7f115d348 Merge #188
188: Bump smallvec version to 1.0 r=Amanieu a=messense

See https://github.com/servo/rust-smallvec/pull/175 for changelog

Co-authored-by: messense <messense@icloud.com>
2019-11-04 21:21:04 +00:00
messense a97a65b3f5 Bump minimum Rust version to 1.36 2019-11-04 17:07:03 +08:00
messense a325fc1c9b Bump smallvec version to 1.0 2019-11-04 15:27:18 +08:00
bors[bot] 606041b6f8 Merge #186
186: Safe grow_hashtable r=Amanieu a=faern

Calling `grow_hashtable` can't do unsafe stuff unless `HASHTABLE` has been wrongfully manipulated. So there are no safety invariants to uphold as a caller. So it does not need to be `unsafe`. The little unsafe Rust used inside it has instead been contained and documented.

Moving the hardest to understand/read part, linked list handling, into a separate function for isolation and to make it easier to understand on its own.

Co-authored-by: Linus Färnstrand <faern@faern.net>
2019-10-10 13:45:53 +00:00
Linus Färnstrand 466d2d924c Mark grow_hashtable as safe. Extract linked list handling 2019-10-09 20:21:55 +02:00
Linus Färnstrand a01e0000ea Tiny lock_bucket simplifications 2019-10-09 20:18:13 +02:00
bors[bot] dd463093f3 Merge #185
185: Replace deprecated mem::uninitialized() r=Amanieu a=faern

Follow up to #173. If we vendor the parts of `MaybeUninit` we need for the places where we use it, then we can get rid of all `mem::uninitialized` and still support Rust older than 1.36.

Because my impression is that there is no way `parking_lot` will make it into `std` while using methods `std` has deprecated and explicitly stated no one should use.

I was not able to make the vendored version `#[repr(transparent)]`.

Co-authored-by: Linus Färnstrand <faern@faern.net>
2019-10-04 07:00:32 +00:00
Linus Färnstrand 195d98182c Use normal #[inline] instead of with (always) 2019-10-04 08:53:47 +02:00
Linus Färnstrand de659e755d Replace mem::uninitialized with MaybeUninit everywhere 2019-10-04 08:53:03 +02:00
Linus Färnstrand 95e6594787 Vendor MaybeUninit from libcore for old Rust versions 2019-10-04 08:53:03 +02:00
bors[bot] 91cdf0d3c8 Merge #183
183: Make locking buckets a safe operation r=Amanieu a=faern

There should not be anything `unsafe` about locking `HashTable` buckets. There is no input you can give it, nor state you can cause by calling other public functions in this module that will make the lock bucket functions behave unsafely. Unless I missed some aspect of course.

I first made `get_hashtable` and `create_hashtable` return static safe references instead of raw pointers, so working with the returned HashTable became a bit easier. The returned pointers are going to always point to valid HashTables anyway, so I did not see anything unsafe about it. The tables might become inactive, but they will still be there, and never unsafe to access.

Co-authored-by: Linus Färnstrand <faern@faern.net>
2019-10-04 03:00:14 +00:00
bors[bot] 9380984521 Merge #184
184: Fix some typos in doc comments r=Amanieu a=goffrie



Co-authored-by: Geoffry Song <goffrie@gmail.com>
2019-10-04 02:34:18 +00:00
Linus Färnstrand 39167068f8 Fix deadlock detection for new get_hashtable 2019-10-03 09:30:08 +02:00
Linus Färnstrand 3a92c14418 Add lock_bucket documentation 2019-10-03 09:09:05 +02:00
Linus Färnstrand 7016b91efb Add documentation safety section to unlock_bucket_pair 2019-10-03 08:57:30 +02:00
Linus Färnstrand c0d9ba114e Make lock_bucket functions not unsafe 2019-10-03 08:57:30 +02:00
Linus Färnstrand d0e082b7ec Make {get,create}_hashtable return static reference 2019-10-03 08:57:30 +02:00