Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upReplaced mutex in constellation logging by a reentrant mutex. #12637
Conversation
highfive
commented
Jul 28, 2016
|
The unit tests are the same ones that are used by the Rust reentrant lock implementation. |
| @@ -0,0 +1,217 @@ | |||
| /* This Source Code Form is subject to the terms of the Mozilla Public | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
asajeffrey
Jul 28, 2016
Author
Member
Well I wrote it :)
Actually, you have a point, which is that the unit tests are Apache/MIT licensed, not MPL. I'll fix that.
This comment has been minimized.
This comment has been minimized.
emilio
Jul 28, 2016
Member
Oh, I thought you copied it straight from libstd, but yeah, the tests still apply.
This comment has been minimized.
This comment has been minimized.
asajeffrey
Jul 28, 2016
Author
Member
No, it's the same interface as the libstd version, but implemented on top of std, rather than using reentrant locks from the OS.
| // TODO: can we use the thread-id crate for this? | ||
|
|
||
| #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)] | ||
| pub struct ThreadId(NonZero<usize>); |
This comment has been minimized.
This comment has been minimized.
emilio
Jul 28, 2016
Member
It would be nice to standardize this kind of things, we already have something like that in style/tid, would you mind filling a issue about this?
This comment has been minimized.
This comment has been minimized.
Amanieu
Jul 28, 2016
I would recommend using the thread-id crate instead since it does not make use of thread-local storage, which can be slow on some platforms.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
asajeffrey
Jul 28, 2016
Author
Member
@Amanieu: I'd like to get this landed, then think about whether we can improve it by using third-party crates. Adding new dependencies to Servo is fairly easy, but not completely trivial.
|
I don't think you need to ignore all the lints for the tests (see https://github.com/asajeffrey/servo/blob/3f2b55aa0b00d45c9bea873d55dc912298e17de0/python/tidy/servo_tidy/licenseck.py#L62). LGTM, I'd like to review the mutex a bit more carefully, though in the meantime I guess we can give it a try run: @bors-servo: try |
…-mutex, r=<try> Replaced mutex in constellation logging by a reentrant mutex. <!-- Please describe your changes on the following line: --> The double-panic in #12553 may be caused by using a non-reentrant lock, which panics on reetry. This PR adds a reentrant lock type (slightly annoyingly, the implementation in std isn't exported) and uses it for logging. cc @jdm --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #12619. - [X] These changes do not require tests because they are designed to remove a class of intermittents. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12637) <!-- Reviewable:end -->
|
|
|
http://build.servo.org/builders/mac-dev-unit/builds/2291 is failing because it's trying to build remutex (which uses unstable |
|
@bors-servo: try LGTM with squash, let's see what try thinks :P |
…-mutex, r=<try> Replaced mutex in constellation logging by a reentrant mutex. <!-- Please describe your changes on the following line: --> The double-panic in #12553 may be caused by using a non-reentrant lock, which panics on reetry. This PR adds a reentrant lock type (slightly annoyingly, the implementation in std isn't exported) and uses it for logging. cc @jdm --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #12619. - [X] These changes do not require tests because they are designed to remove a class of intermittents. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12637) <!-- Reviewable:end -->
|
|
22fe34c
to
e3030d0
|
Squashed. |
|
I think the failure of |
|
On IRC, @jdm says this is #12654. http://logs.glob.uno/?c=mozilla%23servo&s=29+Jul+2016&e=29+Jul+2016#c491848 @emilio is this r=you? |
|
@bors-servo: r+ Yep, lgtm. |
|
|
…-mutex, r=emilio Replaced mutex in constellation logging by a reentrant mutex. <!-- Please describe your changes on the following line: --> The double-panic in #12553 may be caused by using a non-reentrant lock, which panics on reetry. This PR adds a reentrant lock type (slightly annoyingly, the implementation in std isn't exported) and uses it for logging. cc @jdm --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #12619. - [X] These changes do not require tests because they are designed to remove a class of intermittents. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12637) <!-- Reviewable:end -->
|
|
asajeffrey commentedJul 28, 2016
•
edited by larsbergstrom
The double-panic in #12553 may be caused by using a non-reentrant lock, which panics on reetry. This PR adds a reentrant lock type (slightly annoyingly, the implementation in std isn't exported) and uses it for logging. cc @jdm
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is