mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-12-25 20:45:00 +00:00
1d4d44a8e2
This CL adds a crate `sync` containing a type sync::Mutex which wraps the standard library Mutex and mirrors the same methods, except that they panic where the standard library would return a PoisonError. This API codifies our error handling strategy around poisoned mutexes in crosvm. - Crosvm releases are built with panic=abort so poisoning never occurs. A panic while a mutex is held (or ever) takes down the entire process. Thus we would like for code not to have to consider the possibility of poison. - We could ask developers to always write `.lock().unwrap()` on a standard library mutex. However, we would like to stigmatize the use of unwrap. It is confusing to permit unwrap but only on mutex lock results. During code review it may not always be obvious whether a particular unwrap is unwrapping a mutex lock result or a different error that should be handled in a more principled way. Developers should feel free to use sync::Mutex anywhere in crosvm that they would otherwise be using std::sync::Mutex. TEST=boot linux Change-Id: I9727b6f8fee439edb4a8d52cf19d59acf04d990f Reviewed-on: https://chromium-review.googlesource.com/1359923 Commit-Ready: David Tolnay <dtolnay@chromium.org> Tested-by: David Tolnay <dtolnay@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
24 lines
574 B
TOML
24 lines
574 B
TOML
[package]
|
|
name = "x86_64"
|
|
version = "0.1.0"
|
|
authors = ["The Chromium OS Authors"]
|
|
build = "build.rs"
|
|
|
|
[dependencies]
|
|
arch = { path = "../arch" }
|
|
data_model = { path = "../data_model" }
|
|
devices = { path = "../devices" }
|
|
io_jail = { path = "../io_jail" }
|
|
kvm_sys = { path = "../kvm_sys" }
|
|
kvm = { path = "../kvm" }
|
|
sync = { path = "../sync" }
|
|
sys_util = { path = "../sys_util" }
|
|
resources = { path = "../resources" }
|
|
kernel_cmdline = { path = "../kernel_cmdline" }
|
|
kernel_loader = { path = "../kernel_loader" }
|
|
libc = "*"
|
|
byteorder = "*"
|
|
|
|
[build-dependencies]
|
|
cc = "=1.0.15"
|
|
|