servo/components
bors-servo e217672c1a
Auto merge of #22092 - paulrouget:thread_count, r=manishearth
Count threads at shutdown, warn if not all finished and optionally block

On Desktop, after servo shutdown, the process exits, killing all the still-running threads.
On mobile, the process doesn't necessarily shutdown, and we are left with multiple threads failing to use channels, printing warning and panicking.

In the future, we'd like to do a clean shutdown, as in, shutdown only once all the threads have properly finished.

For now, I'm printing a warning if all the threads are not finished, and also add an option to only exit if all the threads have finished.

This only works on MacOS for now, in C, as I haven't found a Rust/multiplatform way to count running threads.

I recommend trying to run servo with `--clean-shutdown` option. Interesting to see how long it takes for other threads to shutdown, and see which threads start panicking.

---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/22092)
<!-- Reviewable:end -->
2018-11-06 02:26:39 -05:00
..
allocator Format component allocator #21373 2018-08-16 15:44:54 +08:00
atoms style: Add the safe area constant names as atoms. 2018-11-05 12:36:14 +01:00
bluetooth Add a build switch to disable the native bluetooth backend. 2018-10-30 19:26:42 -04:00
bluetooth_traits Add lots of derived Debug impls 2018-10-29 09:21:37 -05:00
canvas Update remaining references to cssparser 0.24. 2018-11-05 12:33:37 +01:00
canvas_traits Update remaining references to cssparser 0.24. 2018-11-05 12:33:37 +01:00
channel add servo_channel crate 2018-09-12 11:25:45 +08:00
compositing Removed unused in_scroll_transaction and removed import of std::time:Instant since it was only used by in_scroll_transaction. 2018-11-04 13:00:39 -05:00
config Count threads at shutdown and warn if not all finished 2018-11-06 07:50:04 +01:00
constellation Remove Constellation::focused_browsing_context_id 2018-11-02 21:44:32 +01:00
debugger Replace mpsc with crossbeam/servo channel, update ipc-channel 2018-09-12 13:33:32 +08:00
deny_public_fields Format components debugger and deny_public_fields #21373 2018-09-01 09:44:53 +08:00
devtools Update hyper to 0.12 2018-11-01 19:17:36 +01:00
devtools_traits Update hyper to 0.12 2018-11-01 19:17:36 +01:00
dom_struct Format components dom_struct, domobject_derive and embedder_traits #21373 2018-09-03 08:19:25 +08:00
domobject_derive Format components dom_struct, domobject_derive and embedder_traits #21373 2018-09-03 08:19:25 +08:00
embedder_traits Auto merge of #21881 - pyfisch:keyboard-types, r=paulrouget 2018-10-17 05:36:08 -04:00
fallible Partially revert #21746. 2018-09-22 18:51:42 +02:00
geometry Move malloc_size_of_derive to proper position 2018-09-04 11:29:38 +08:00
gfx Auto merge of #22028 - asajeffrey:debug-all-the-things, r=emilio 2018-10-29 14:17:02 -04:00
gfx_traits Format gfx_traits #21373 2018-09-09 10:11:08 +08:00
hashglobe Format hashglobe #21373 2018-09-09 10:14:36 +08:00
jstraceable_derive Format jstraceable_derive #21373 2018-09-10 11:03:38 +08:00
layout Directly build WebRender LineDisplayItem 2018-10-28 22:23:36 +01:00
layout_thread Make layout use available image data before querying the image cache. 2018-10-12 21:55:09 -04:00
layout_traits Replace mpsc with crossbeam/servo channel, update ipc-channel 2018-09-12 13:33:32 +08:00
malloc_size_of Auto merge of #22103 - Eijebong:formdata, r=jdm 2018-11-05 22:50:40 -05:00
malloc_size_of_derive Rustfmt malloc_size_of & derive 2018-09-05 10:32:44 +02:00
metrics Auto merge of #21325 - gterzian:crossbeam_integration, r=SimonSapin,jdm 2018-09-12 13:33:45 -04:00
msg Add lots of derived Debug impls 2018-10-29 09:21:37 -05:00
net Reduce right drift in scheme_fetch 2018-11-03 16:15:48 +01:00
net_traits Rustfmt net_traits crate 2018-11-03 16:18:44 +01:00
pixels Share some code between 2D canvas and WebGL 2018-10-09 14:57:02 +02:00
profile Update hyper to 0.12 2018-11-01 19:17:36 +01:00
profile_traits Add lots of derived Debug impls 2018-10-29 09:21:37 -05:00
rand
range format components/range using rustfmt 2018-09-12 12:32:31 +05:30
remutex format components/remutex 2018-09-12 12:37:11 +05:30
script Auto merge of #22112 - servo:webgl, r=jdm 2018-11-06 00:04:43 -05:00
script_layout_interface Update remaining references to cssparser 0.24. 2018-11-05 12:33:37 +01:00
script_plugins Format components/script_plugins 2018-09-13 01:01:35 +09:00
script_traits Update hyper to 0.12 2018-11-01 19:17:36 +01:00
selectors style: Implement the env() function with hardcoded zeros for safe-area-inset. 2018-11-05 12:33:16 +01:00
servo Add a build switch to disable the native bluetooth backend. 2018-10-30 19:26:42 -04:00
servo_arc Fix tidy issues. 2018-09-18 11:46:01 +02:00
size_of_test Format component size_of_test 2018-09-10 21:31:38 +09:00
std_test_override Make mach test-unit not recompile components after mach build 2018-10-07 13:27:23 +02:00
style style: Fix servo build. 2018-11-05 12:44:54 +01:00
style_derive style: Teach ComputeSquaredDistance derive about #[animation(constant)]. 2018-09-15 17:56:41 +02:00
style_traits style: Implement the env() function with hardcoded zeros for safe-area-inset. 2018-11-05 12:33:16 +01:00
url Remove Origin::unicode_serialization 2018-10-12 10:25:03 +02:00
webdriver_server Update hyper to 0.12 2018-11-01 19:17:36 +01:00
webvr Replace mpsc with crossbeam/servo channel, update ipc-channel 2018-09-12 13:33:32 +08:00
webvr_traits Add lots of derived Debug impls 2018-10-29 09:21:37 -05:00