mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Auto merge of #11497 - ab22:11467-resource-threads-race-with-shutdown-to-write-out-data, r=Ms2ger
send a reply when thread is done exiting <!-- Please describe your changes on the following line: --> --- <!-- 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 #11467 <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because: in this case if code compiles then it's good enough. <!-- 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11497) <!-- Reviewable:end -->
This commit is contained in:
commit
351b851e21
6 changed files with 33 additions and 11 deletions
|
@ -39,13 +39,16 @@ impl LoadOrigin for ResourceTest {
|
|||
#[test]
|
||||
fn test_exit() {
|
||||
let (tx, _rx) = ipc::channel().unwrap();
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let resource_thread = new_core_resource_thread("".to_owned(), None, ProfilerChan(tx));
|
||||
resource_thread.send(CoreResourceMsg::Exit).unwrap();
|
||||
resource_thread.send(CoreResourceMsg::Exit(sender)).unwrap();
|
||||
receiver.recv().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_bad_scheme() {
|
||||
let (tx, _rx) = ipc::channel().unwrap();
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let resource_thread = new_core_resource_thread("".to_owned(), None, ProfilerChan(tx));
|
||||
let (start_chan, start) = ipc::channel().unwrap();
|
||||
let url = Url::parse("bogus://whatever").unwrap();
|
||||
|
@ -57,7 +60,8 @@ fn test_bad_scheme() {
|
|||
ProgressMsg::Done(result) => { assert!(result.is_err()) }
|
||||
_ => panic!("bleh")
|
||||
}
|
||||
resource_thread.send(CoreResourceMsg::Exit).unwrap();
|
||||
resource_thread.send(CoreResourceMsg::Exit(sender)).unwrap();
|
||||
receiver.recv().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -223,6 +227,7 @@ fn test_cancelled_listener() {
|
|||
});
|
||||
|
||||
let (tx, _rx) = ipc::channel().unwrap();
|
||||
let (exit_sender, exit_receiver) = ipc::channel().unwrap();
|
||||
let resource_thread = new_core_resource_thread("".to_owned(), None, ProfilerChan(tx));
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let (id_sender, id_receiver) = ipc::channel().unwrap();
|
||||
|
@ -244,5 +249,6 @@ fn test_cancelled_listener() {
|
|||
let response = receiver.recv().unwrap();
|
||||
assert_eq!(response.progress_port.recv().unwrap(),
|
||||
ProgressMsg::Done(Err(NetworkError::LoadCancelled)));
|
||||
resource_thread.send(CoreResourceMsg::Exit).unwrap();
|
||||
resource_thread.send(CoreResourceMsg::Exit(exit_sender)).unwrap();
|
||||
exit_receiver.recv().unwrap();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue