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
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
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
deny_public_fields
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
domobject_derive
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
gfx Auto merge of #22028 - asajeffrey:debug-all-the-things, r=emilio 2018-10-29 14:17:02 -04:00
gfx_traits
hashglobe
jstraceable_derive
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
malloc_size_of Auto merge of #22103 - Eijebong:formdata, r=jdm 2018-11-05 22:50:40 -05:00
malloc_size_of_derive
metrics
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
remutex
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
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
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_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
webvr_traits Add lots of derived Debug impls 2018-10-29 09:21:37 -05:00