forked from mirrors/gecko-dev
Bug 1746533 - Part 1: Use custom vendored version of async-task, r=emilio
This version adds a new `FallibleTask` wrapper type which allows polling the task without panicking. Differential Revision: https://phabricator.services.mozilla.com/D136945
This commit is contained in:
parent
a8eecb0574
commit
3207c4d890
18 changed files with 197 additions and 487 deletions
|
|
@ -2,6 +2,11 @@
|
|||
# It was generated by `mach vendor rust`.
|
||||
# Please do not edit.
|
||||
|
||||
[source."https://github.com/smol-rs/async-task"]
|
||||
git = "https://github.com/smol-rs/async-task"
|
||||
replace-with = "vendored-sources"
|
||||
rev = "f6488e35beccb26eb6e85847b02aa78a42cd3d0e"
|
||||
|
||||
[source."https://github.com/msirringhaus/minidump_writer_linux.git"]
|
||||
git = "https://github.com/msirringhaus/minidump_writer_linux.git"
|
||||
replace-with = "vendored-sources"
|
||||
|
|
|
|||
3
Cargo.lock
generated
3
Cargo.lock
generated
|
|
@ -144,8 +144,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "async-task"
|
||||
version = "4.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0"
|
||||
source = "git+https://github.com/smol-rs/async-task?rev=f6488e35beccb26eb6e85847b02aa78a42cd3d0e#f6488e35beccb26eb6e85847b02aa78a42cd3d0e"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ web-sys = { path = "build/rust/dummy-web/web-sys" }
|
|||
moz_asserts = { path = "mozglue/static/rust/moz_asserts" }
|
||||
|
||||
# Other overrides
|
||||
async-task = { git = "https://github.com/smol-rs/async-task", rev="f6488e35beccb26eb6e85847b02aa78a42cd3d0e" }
|
||||
chardetng = { git = "https://github.com/hsivonen/chardetng", rev="3484d3e3ebdc8931493aa5df4d7ee9360a90e76b" }
|
||||
chardetng_c = { git = "https://github.com/hsivonen/chardetng_c", rev="ed8a4c6f900a90d4dbc1d64b856e61490a1c3570" }
|
||||
coremidi = { git = "https://github.com/chris-zen/coremidi.git", rev="fc68464b5445caf111e41f643a2e69ccce0b4f83" }
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"files":{"CHANGELOG.md":"c4c2357aca3a55880f58ce71001fe55a2ad5b08c272cbbeb5f55888b3c405a8a","Cargo.lock":"a0bcb2e3475e6b59771885f1cf0d2e90192e408a131db86d73ce245176924986","Cargo.toml":"a62cd371c630cfb67b1e942c5a9088ef0e42c05633b3caa780ef9d189c7846f1","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"0aba4f4b778650826a1d565551c6d7e96898e2ceb76ee6673232adbd075fec0a","benches/spawn.rs":"9272992dbc058734be04e4b1c0c92fa16f62eebe062c2ce74bbedfae1ce36689","examples/spawn-local.rs":"729d6b8ef55fad9387e8912567160766fb00c3880a7acbdcab7316aefe7811c3","examples/spawn-on-thread.rs":"90c5ffcbe11b847a9201a83ac2f036bf1721dfe971708781a0769ef8354e87c9","examples/spawn.rs":"360c86d609eea98333ba6284ebf8eeb73acc651f07d30b0dd5879757b4bf6125","src/header.rs":"956b92793bd20ef94b300cda3e7e9e70cadcbd6f5b57c7f0053e6f81e6002867","src/lib.rs":"04bb2ea9bf584f57295f090c3d49489d3f7b019942f3872cecc0f4935cb4a080","src/raw.rs":"6c3650d79e39f898826ddebd0eea37305b1013e427eaff331e7da3c71da247ab","src/runnable.rs":"df5975f32539733b3df989c120f80ea3cd5a645be782b166f3f334835ace4d91","src/state.rs":"73ec4b98e8519faad882c1ee19711066a9e2a9b2cf9441436f145c8597e2b93d","src/task.rs":"2e6093650fdb637baeacc9257e813f78c38eec79b8f689370b206a06d4122bfa","src/utils.rs":"233350fa35223b286d144194b04c0549c3b7d2e378e1f61d7d31a807e1416d17","tests/basic.rs":"dfe397fddbe73226b419bdc93ad5de217246bbb4e6f735e4932f6dc415ada06f","tests/cancel.rs":"c0970386cfca05e27f113f62781eee6825dc1bd8632e7a760759123bb0d06f3a","tests/join.rs":"88080b81e3b932571deeb2ff7adc3dabb2e14522b012e4dd6c76bca454f7f518","tests/panic.rs":"283c70daee381798f5a210c1995b1075d3320a78ad0c7007db7b534d2d03d43d","tests/ready.rs":"a899d303f51f289c0f98830f41061ca62e0d57e3aa0f061981b0a28eeb05de2e","tests/waker_panic.rs":"cc4a5207bf28a6cf3fd41a5a8f13d371db42ef7561b6e71dd9853f7f94f8a3f4","tests/waker_pending.rs":"c1511b616770fc1870b3a9e203934a3239ad0e31c6bcb5dd7e9acfd9c9e4e1ef","tests/waker_ready.rs":"5a2e19e9642cb2a631dbbeec4f84dbe79d8eeafaac32cb65192f64922085724b"},"package":"e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0"}
|
||||
{"files":{"CHANGELOG.md":"c4c2357aca3a55880f58ce71001fe55a2ad5b08c272cbbeb5f55888b3c405a8a","Cargo.toml":"e10e2b49a756cd051f1b642c51df4a8387965078c2fd4c885f6388a66c6ab56d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"91a65b44a1692a16fa2d2f5bb424e78177f0c0ca0051e93db20443568377d5e5","benches/spawn.rs":"9272992dbc058734be04e4b1c0c92fa16f62eebe062c2ce74bbedfae1ce36689","examples/spawn-local.rs":"729d6b8ef55fad9387e8912567160766fb00c3880a7acbdcab7316aefe7811c3","examples/spawn-on-thread.rs":"90c5ffcbe11b847a9201a83ac2f036bf1721dfe971708781a0769ef8354e87c9","examples/spawn.rs":"360c86d609eea98333ba6284ebf8eeb73acc651f07d30b0dd5879757b4bf6125","src/header.rs":"956b92793bd20ef94b300cda3e7e9e70cadcbd6f5b57c7f0053e6f81e6002867","src/lib.rs":"f579f26e7b7b7c521f280ec876202650f4bac4d573734f40f05204d74327ed73","src/raw.rs":"6c3650d79e39f898826ddebd0eea37305b1013e427eaff331e7da3c71da247ab","src/runnable.rs":"24a2e33464a17bff4828e655ac77a6c7b87a335f35f8dc00b614d7542bdaf955","src/state.rs":"73ec4b98e8519faad882c1ee19711066a9e2a9b2cf9441436f145c8597e2b93d","src/task.rs":"5e822d51335139d9fa49655027150de43dd72fd6852a41c0bcb3f9e5dcae0e4b","src/utils.rs":"233350fa35223b286d144194b04c0549c3b7d2e378e1f61d7d31a807e1416d17","tests/basic.rs":"2346fc837af82d1f76f1dc2c799b0b4b35b92e61455b40e37d2698e87be84a42","tests/cancel.rs":"3316abbad56d06e1690e7d547aeec4acf3f4e2a84607684f840d6cb13ec5b057","tests/join.rs":"815e628cb77f1d42bdc0455a71818278e0a8b381efc090f8f843115b23ea734a","tests/panic.rs":"22bf21ce9a0b6d5558a54207a86aa2c3b13475aacccce7f619427056660fa427","tests/ready.rs":"357112e398d1f982585c76c2f49325ab1f2673f026c120fb10d9b92ee42188af","tests/waker_panic.rs":"9777f381d3c9a98fef9e480345d2df18dec286118fef5f7f18033b08a43e0cec","tests/waker_pending.rs":"40dcf6eac4f0902e888657883be411bb376ab7db53a3c720a84fe122539508e6","tests/waker_ready.rs":"4b230ebf2af301058771d78350bbb558f96eafaa2aee18ec5cfed74d5e3f3628"},"package":null}
|
||||
421
third_party/rust/async-task/Cargo.lock
generated
vendored
421
third_party/rust/async-task/Cargo.lock
generated
vendored
|
|
@ -1,421 +0,0 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "arc-swap"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034"
|
||||
|
||||
[[package]]
|
||||
name = "async-barrier"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c06293698675eb72e1155867e5982f199d6b6c230dca35bc5ffd9852f470c22a"
|
||||
dependencies = [
|
||||
"async-mutex",
|
||||
"event-listener",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-channel"
|
||||
version = "1.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21279cfaa4f47df10b1816007e738ca3747ef2ee53ffc51cdbf57a8bb266fee3"
|
||||
dependencies = [
|
||||
"concurrent-queue",
|
||||
"event-listener",
|
||||
"futures-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-executor"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a831e74aa1937d3bbd3a356f34c23dbc6b6f0abc5160bd5484a9f75d5e76aea8"
|
||||
dependencies = [
|
||||
"async-task 3.0.0",
|
||||
"concurrent-queue",
|
||||
"fastrand",
|
||||
"futures-lite",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-fs"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3572236ba37147ca2b674a0bd5afd20aec0cd925ab125ab6fad6543960f9002"
|
||||
dependencies = [
|
||||
"blocking",
|
||||
"futures-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-io"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "64c629684e697f58c0e99e5e2d84a840e3b336afbcfdbac7b44c3b1e222c2fd8"
|
||||
dependencies = [
|
||||
"concurrent-queue",
|
||||
"fastrand",
|
||||
"futures-lite",
|
||||
"log",
|
||||
"nb-connect",
|
||||
"once_cell",
|
||||
"parking",
|
||||
"polling",
|
||||
"vec-arena",
|
||||
"waker-fn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-lock"
|
||||
version = "2.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab3ad7fb4345397e57c19566844b0eba274b92e5d2d2791bb0664cc441697b95"
|
||||
dependencies = [
|
||||
"async-barrier",
|
||||
"async-mutex",
|
||||
"async-rwlock",
|
||||
"async-semaphore",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-mutex"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "66941c2577c4fa351e4ce5fdde8f86c69b88d623f3b955be1bc7362a23434632"
|
||||
dependencies = [
|
||||
"event-listener",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-net"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a48af5438be856056bdeb6c5d895148a715be5915fccee49d1e5b50851dc9b8b"
|
||||
dependencies = [
|
||||
"async-io",
|
||||
"blocking",
|
||||
"futures-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-process"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bb915df28b8309139bd9c9c700d84c20e5c21385d05378caa84912332d0f6a1"
|
||||
dependencies = [
|
||||
"async-io",
|
||||
"blocking",
|
||||
"cfg-if",
|
||||
"event-listener",
|
||||
"futures-lite",
|
||||
"once_cell",
|
||||
"signal-hook",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-rwlock"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f8978b5ae008b5177da07a1bf1bfbe428f9bdb970c3fca0e92ed1c1930d7f34"
|
||||
dependencies = [
|
||||
"async-mutex",
|
||||
"event-listener",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-semaphore"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "66d2be5973230861689460806b8db059bbd8bcb507cabaa71646ae89f5b2f2ee"
|
||||
dependencies = [
|
||||
"event-listener",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-task"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c17772156ef2829aadc587461c7753af20b7e8db1529bc66855add962a3b35d3"
|
||||
|
||||
[[package]]
|
||||
name = "async-task"
|
||||
version = "4.0.3"
|
||||
dependencies = [
|
||||
"atomic-waker",
|
||||
"easy-parallel",
|
||||
"flume",
|
||||
"once_cell",
|
||||
"smol",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atomic-waker"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a"
|
||||
|
||||
[[package]]
|
||||
name = "blocking"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2640778f8053e72c11f621b0a5175a0560a269282aa98ed85107773ab8e2a556"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"atomic-waker",
|
||||
"fastrand",
|
||||
"futures-lite",
|
||||
"once_cell",
|
||||
"waker-fn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cache-padded"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
|
||||
[[package]]
|
||||
name = "concurrent-queue"
|
||||
version = "1.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
|
||||
dependencies = [
|
||||
"cache-padded",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "easy-parallel"
|
||||
version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1dd4afd79212583ff429b913ad6605242ed7eec277e950b1438f300748f948f4"
|
||||
|
||||
[[package]]
|
||||
name = "event-listener"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1cd41440ae7e4734bbd42302f63eaba892afc93a3912dad84006247f0dedb0e"
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c85295147490b8fcf2ea3d104080a105a8b2c63f9c319e82c02d8e952388919"
|
||||
|
||||
[[package]]
|
||||
name = "flume"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f7d4f1d85cb8cafb73c01d872e0124a96e603f5b7633ce1eac70015f066e946"
|
||||
dependencies = [
|
||||
"spinning_top",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399"
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789"
|
||||
|
||||
[[package]]
|
||||
name = "futures-lite"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b77e08e656f472d8ea84c472fa8b0a7a917883048e1cf2d4e34a323cd0aaf63"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"memchr",
|
||||
"parking",
|
||||
"pin-project-lite",
|
||||
"waker-fn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.77"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c"
|
||||
dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
|
||||
|
||||
[[package]]
|
||||
name = "nb-connect"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e847c76b390f44529c2071ef06d0b52fbb4bdb04cc8987a5cfa63954c000abca"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad"
|
||||
|
||||
[[package]]
|
||||
name = "parking"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715"
|
||||
|
||||
[[package]]
|
||||
name = "polling"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0307b8c7f438902536321f63c28cab0362f6ee89f1c7da47e3642ff956641c8b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"log",
|
||||
"wepoll-sys-stjepang",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook"
|
||||
version = "0.1.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "604508c1418b99dfe1925ca9224829bb2a8a9a04dda655cc01fcad46f4ab05ed"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"signal-hook-registry",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smol"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712d02afa6ac9e7b8c777fd181aff476d009280b54b8c28703d10fa5d7e80d83"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"async-executor",
|
||||
"async-fs",
|
||||
"async-io",
|
||||
"async-lock",
|
||||
"async-net",
|
||||
"async-process",
|
||||
"blocking",
|
||||
"futures-lite",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spinning_top"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e529d73e80d64b5f2631f9035113347c578a1c9c7774b83a2b880788459ab36"
|
||||
dependencies = [
|
||||
"lock_api",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vec-arena"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d"
|
||||
|
||||
[[package]]
|
||||
name = "waker-fn"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
|
||||
|
||||
[[package]]
|
||||
name = "wepoll-sys-stjepang"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fdfbb03f290ca0b27922e8d48a0997b4ceea12df33269b9f75e713311eb178d"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
53
third_party/rust/async-task/Cargo.toml
vendored
53
third_party/rust/async-task/Cargo.toml
vendored
|
|
@ -1,44 +1,31 @@
|
|||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g., crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
|
||||
[package]
|
||||
edition = "2018"
|
||||
name = "async-task"
|
||||
# When publishing a new version:
|
||||
# - Update CHANGELOG.md
|
||||
# - Create "v4.x.y" git tag
|
||||
version = "4.0.3"
|
||||
authors = ["Stjepan Glavina <stjepang@gmail.com>"]
|
||||
edition = "2018"
|
||||
rust-version = "1.39"
|
||||
license = "Apache-2.0 OR MIT"
|
||||
repository = "https://github.com/smol-rs/async-task"
|
||||
description = "Task abstraction for building executors"
|
||||
homepage = "https://github.com/stjepang/async-task"
|
||||
documentation = "https://docs.rs/async-task"
|
||||
readme = "README.md"
|
||||
keywords = ["futures", "task", "executor", "spawn"]
|
||||
categories = ["asynchronous", "concurrency", "no-std"]
|
||||
license = "Apache-2.0/MIT"
|
||||
repository = "https://github.com/stjepang/async-task"
|
||||
[dev-dependencies.atomic-waker]
|
||||
version = "1.0.0"
|
||||
|
||||
[dev-dependencies.easy-parallel]
|
||||
version = "3.1.0"
|
||||
|
||||
[dev-dependencies.flume]
|
||||
version = "0.9.0"
|
||||
default-features = false
|
||||
|
||||
[dev-dependencies.once_cell]
|
||||
version = "1.4.1"
|
||||
|
||||
[dev-dependencies.smol]
|
||||
version = "1.0.1"
|
||||
exclude = ["/.*"]
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = []
|
||||
|
||||
[dev-dependencies]
|
||||
atomic-waker = "1"
|
||||
easy-parallel = "3"
|
||||
flaky_test = "0.1"
|
||||
flume = { version = "0.10", default-features = false }
|
||||
once_cell = "1"
|
||||
smol = "1"
|
||||
|
||||
# rewrite dependencies to use the this version of async-task when running tests
|
||||
[patch.crates-io]
|
||||
async-task = { path = "." }
|
||||
|
|
|
|||
8
third_party/rust/async-task/README.md
vendored
8
third_party/rust/async-task/README.md
vendored
|
|
@ -1,9 +1,9 @@
|
|||
# async-task
|
||||
|
||||
[](
|
||||
https://github.com/stjepang/async-task/actions)
|
||||
[](
|
||||
https://github.com/stjepang/async-task)
|
||||
[](
|
||||
https://github.com/smol-rs/async-task/actions)
|
||||
[](
|
||||
https://github.com/smol-rs/async-task)
|
||||
[](
|
||||
https://crates.io/crates/async-task)
|
||||
[](
|
||||
|
|
|
|||
2
third_party/rust/async-task/src/lib.rs
vendored
2
third_party/rust/async-task/src/lib.rs
vendored
|
|
@ -82,7 +82,7 @@ mod task;
|
|||
mod utils;
|
||||
|
||||
pub use crate::runnable::{spawn, spawn_unchecked, Runnable};
|
||||
pub use crate::task::Task;
|
||||
pub use crate::task::{FallibleTask, Task};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub use crate::runnable::spawn_local;
|
||||
|
|
|
|||
2
third_party/rust/async-task/src/runnable.rs
vendored
2
third_party/rust/async-task/src/runnable.rs
vendored
|
|
@ -147,7 +147,7 @@ where
|
|||
/// This function is same as [`spawn()`], except it does not require [`Send`], [`Sync`], and
|
||||
/// `'static` on `future` and `schedule`.
|
||||
///
|
||||
/// Safety requirements:
|
||||
/// # Safety
|
||||
///
|
||||
/// - If `future` is not [`Send`], its [`Runnable`] must be used and dropped on the original
|
||||
/// thread.
|
||||
|
|
|
|||
164
third_party/rust/async-task/src/task.rs
vendored
164
third_party/rust/async-task/src/task.rs
vendored
|
|
@ -124,18 +124,56 @@ impl<T> Task<T> {
|
|||
pub async fn cancel(self) -> Option<T> {
|
||||
let mut this = self;
|
||||
this.set_canceled();
|
||||
this.fallible().await
|
||||
}
|
||||
|
||||
struct Fut<T>(Task<T>);
|
||||
|
||||
impl<T> Future for Fut<T> {
|
||||
type Output = Option<T>;
|
||||
|
||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||
self.0.poll_task(cx)
|
||||
}
|
||||
}
|
||||
|
||||
Fut(this).await
|
||||
/// Converts this task into a [`FallibleTask`].
|
||||
///
|
||||
/// Like [`Task`], a fallible task will poll the task's output until it is
|
||||
/// completed or cancelled due to its [`Runnable`][`super::Runnable`] being
|
||||
/// dropped without being run. Resolves to the task's output when completed,
|
||||
/// or [`None`] if it didn't complete.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use smol::{future, Executor};
|
||||
/// use std::thread;
|
||||
///
|
||||
/// let ex = Executor::new();
|
||||
///
|
||||
/// // Spawn a future onto the executor.
|
||||
/// let task = ex.spawn(async {
|
||||
/// println!("Hello from a task!");
|
||||
/// 1 + 2
|
||||
/// })
|
||||
/// .fallible();
|
||||
///
|
||||
/// // Run an executor thread.
|
||||
/// thread::spawn(move || future::block_on(ex.run(future::pending::<()>())));
|
||||
///
|
||||
/// // Wait for the task's output.
|
||||
/// assert_eq!(future::block_on(task), Some(3));
|
||||
/// ```
|
||||
///
|
||||
/// ```
|
||||
/// use smol::future;
|
||||
///
|
||||
/// // Schedule function which drops the runnable without running it.
|
||||
/// let schedule = move |runnable| drop(runnable);
|
||||
///
|
||||
/// // Create a task with the future and the schedule function.
|
||||
/// let (runnable, task) = async_task::spawn(async {
|
||||
/// println!("Hello from a task!");
|
||||
/// 1 + 2
|
||||
/// }, schedule);
|
||||
/// runnable.schedule();
|
||||
///
|
||||
/// // Wait for the task's output.
|
||||
/// assert_eq!(future::block_on(task.fallible()), None);
|
||||
/// ```
|
||||
pub fn fallible(self) -> FallibleTask<T> {
|
||||
FallibleTask { task: self }
|
||||
}
|
||||
|
||||
/// Puts the task in canceled state.
|
||||
|
|
@ -351,6 +389,12 @@ impl<T> Task<T> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn header(&self) -> &Header {
|
||||
let ptr = self.ptr.as_ptr();
|
||||
let header = ptr as *const Header;
|
||||
unsafe { &*header }
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Drop for Task<T> {
|
||||
|
|
@ -373,11 +417,101 @@ impl<T> Future for Task<T> {
|
|||
|
||||
impl<T> fmt::Debug for Task<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let ptr = self.ptr.as_ptr();
|
||||
let header = ptr as *const Header;
|
||||
|
||||
f.debug_struct("Task")
|
||||
.field("header", unsafe { &(*header) })
|
||||
.field("header", self.header())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
/// A spawned task with a fallible response.
|
||||
///
|
||||
/// This type behaves like [`Task`], however it produces an `Option<T>` when
|
||||
/// polled and will return `None` if the executor dropped its
|
||||
/// [`Runnable`][`super::Runnable`] without being run.
|
||||
///
|
||||
/// This can be useful to avoid the panic produced when polling the `Task`
|
||||
/// future if the executor dropped its `Runnable`.
|
||||
#[must_use = "tasks get canceled when dropped, use `.detach()` to run them in the background"]
|
||||
pub struct FallibleTask<T> {
|
||||
task: Task<T>,
|
||||
}
|
||||
|
||||
impl<T> FallibleTask<T> {
|
||||
/// Detaches the task to let it keep running in the background.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use smol::{Executor, Timer};
|
||||
/// use std::time::Duration;
|
||||
///
|
||||
/// let ex = Executor::new();
|
||||
///
|
||||
/// // Spawn a deamon future.
|
||||
/// ex.spawn(async {
|
||||
/// loop {
|
||||
/// println!("I'm a daemon task looping forever.");
|
||||
/// Timer::after(Duration::from_secs(1)).await;
|
||||
/// }
|
||||
/// })
|
||||
/// .fallible()
|
||||
/// .detach();
|
||||
/// ```
|
||||
pub fn detach(self) {
|
||||
self.task.detach()
|
||||
}
|
||||
|
||||
/// Cancels the task and waits for it to stop running.
|
||||
///
|
||||
/// Returns the task's output if it was completed just before it got canceled, or [`None`] if
|
||||
/// it didn't complete.
|
||||
///
|
||||
/// While it's possible to simply drop the [`Task`] to cancel it, this is a cleaner way of
|
||||
/// canceling because it also waits for the task to stop running.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// use smol::{future, Executor, Timer};
|
||||
/// use std::thread;
|
||||
/// use std::time::Duration;
|
||||
///
|
||||
/// let ex = Executor::new();
|
||||
///
|
||||
/// // Spawn a deamon future.
|
||||
/// let task = ex.spawn(async {
|
||||
/// loop {
|
||||
/// println!("Even though I'm in an infinite loop, you can still cancel me!");
|
||||
/// Timer::after(Duration::from_secs(1)).await;
|
||||
/// }
|
||||
/// })
|
||||
/// .fallible();
|
||||
///
|
||||
/// // Run an executor thread.
|
||||
/// thread::spawn(move || future::block_on(ex.run(future::pending::<()>())));
|
||||
///
|
||||
/// future::block_on(async {
|
||||
/// Timer::after(Duration::from_secs(3)).await;
|
||||
/// task.cancel().await;
|
||||
/// });
|
||||
/// ```
|
||||
pub async fn cancel(self) -> Option<T> {
|
||||
self.task.cancel().await
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Future for FallibleTask<T> {
|
||||
type Output = Option<T>;
|
||||
|
||||
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
||||
self.task.poll_task(cx)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> fmt::Debug for FallibleTask<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("FallibleTask")
|
||||
.field("header", self.task.header())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
third_party/rust/async-task/tests/basic.rs
vendored
2
third_party/rust/async-task/tests/basic.rs
vendored
|
|
@ -64,7 +64,7 @@ macro_rules! schedule {
|
|||
|
||||
let guard = Guard(Box::new(0));
|
||||
move |_runnable| {
|
||||
&guard;
|
||||
let _ = &guard;
|
||||
$sched.fetch_add(1, Ordering::SeqCst);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
2
third_party/rust/async-task/tests/cancel.rs
vendored
2
third_party/rust/async-task/tests/cancel.rs
vendored
|
|
@ -81,7 +81,7 @@ macro_rules! schedule {
|
|||
|
||||
let guard = Guard(Box::new(0));
|
||||
move |runnable: Runnable| {
|
||||
&guard;
|
||||
let _ = &guard;
|
||||
runnable.schedule();
|
||||
$sched.fetch_add(1, Ordering::SeqCst);
|
||||
}
|
||||
|
|
|
|||
2
third_party/rust/async-task/tests/join.rs
vendored
2
third_party/rust/async-task/tests/join.rs
vendored
|
|
@ -82,7 +82,7 @@ macro_rules! schedule {
|
|||
|
||||
let guard = Guard(Box::new(0));
|
||||
move |runnable: Runnable| {
|
||||
&guard;
|
||||
let _ = &guard;
|
||||
runnable.schedule();
|
||||
$sched.fetch_add(1, Ordering::SeqCst);
|
||||
}
|
||||
|
|
|
|||
2
third_party/rust/async-task/tests/panic.rs
vendored
2
third_party/rust/async-task/tests/panic.rs
vendored
|
|
@ -69,7 +69,7 @@ macro_rules! schedule {
|
|||
|
||||
let guard = Guard(Box::new(0));
|
||||
move |_runnable: Runnable| {
|
||||
&guard;
|
||||
let _ = &guard;
|
||||
$sched.fetch_add(1, Ordering::SeqCst);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
2
third_party/rust/async-task/tests/ready.rs
vendored
2
third_party/rust/async-task/tests/ready.rs
vendored
|
|
@ -81,7 +81,7 @@ macro_rules! schedule {
|
|||
|
||||
let guard = Guard(Box::new(0));
|
||||
move |_runnable: Runnable| {
|
||||
&guard;
|
||||
let _ = &guard;
|
||||
$sched.fetch_add(1, Ordering::SeqCst);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ macro_rules! schedule {
|
|||
|
||||
let guard = Guard(Box::new(0));
|
||||
let sched = move |runnable: Runnable| {
|
||||
&guard;
|
||||
let _ = &guard;
|
||||
$sched.fetch_add(1, Ordering::SeqCst);
|
||||
s.send(runnable).unwrap();
|
||||
};
|
||||
|
|
@ -238,10 +238,15 @@ fn wake_and_cancel_during_run() {
|
|||
.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[flaky_test::flaky_test]
|
||||
fn cancel_and_wake_during_run() {
|
||||
future!(f, get_waker, POLL, DROP_F);
|
||||
schedule!(s, chan, SCHEDULE, DROP_S);
|
||||
POLL.store(0, Ordering::SeqCst);
|
||||
DROP_F.store(0, Ordering::SeqCst);
|
||||
SCHEDULE.store(0, Ordering::SeqCst);
|
||||
DROP_S.store(0, Ordering::SeqCst);
|
||||
|
||||
let (runnable, task) = async_task::spawn(f, s);
|
||||
|
||||
runnable.run();
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ macro_rules! schedule {
|
|||
|
||||
let guard = Guard(Box::new(0));
|
||||
let sched = move |runnable: Runnable| {
|
||||
&guard;
|
||||
let _ = &guard;
|
||||
$sched.fetch_add(1, Ordering::SeqCst);
|
||||
s.send(runnable).unwrap();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ macro_rules! schedule {
|
|||
|
||||
let guard = Guard(Box::new(0));
|
||||
let sched = move |runnable: Runnable| {
|
||||
&guard;
|
||||
let _ = &guard;
|
||||
$sched.fetch_add(1, Ordering::SeqCst);
|
||||
s.send(runnable).unwrap();
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue