use parking_lot::Once in ffmpeg

I'm getting deprecation warnings for std::sync::ONCE_INIT, and I'm
not sure when std::sync::Once::new() became a const fn. Just as easy to
switch to parking_lot.
This commit is contained in:
Scott Lamb 2019-12-28 08:03:05 -06:00
parent 154d0c30c0
commit e8a00d4639
3 changed files with 4 additions and 2 deletions

1
Cargo.lock generated
View File

@ -1100,6 +1100,7 @@ dependencies = [
"cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

View File

@ -12,6 +12,7 @@ path = "lib.rs"
[dependencies] [dependencies]
libc = "0.2" libc = "0.2"
log = { version = "0.4", features = ["release_max_level_info"] } log = { version = "0.4", features = ["release_max_level_info"] }
parking_lot = { version = "0.9", features = [] }
[build-dependencies] [build-dependencies]
cc = "1.0" cc = "1.0"

View File

@ -29,13 +29,13 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
use log::info; use log::info;
use parking_lot::Once;
use std::cell::{Ref, RefCell}; use std::cell::{Ref, RefCell};
use std::ffi::CStr; use std::ffi::CStr;
use std::fmt::{self, Write}; use std::fmt::{self, Write};
use std::ptr; use std::ptr;
use std::sync;
static START: sync::Once = sync::ONCE_INIT; static START: Once = Once::new();
//#[link(name = "avcodec")] //#[link(name = "avcodec")]
extern "C" { extern "C" {