forked from mirrors/gstreamer-rs
Add #[must_use] attribute to mutex guards / stream lock
It's usually a mistake if creating one of these and immediately dropping them again as that would immediately unlock the mutex again.
This commit is contained in:
parent
ed80467ff6
commit
4e30798ac7
3 changed files with 3 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
|||
use glib::translate::mut_override;
|
||||
use glib_sys;
|
||||
|
||||
#[must_use = "if unused the Mutex will immediately unlock"]
|
||||
pub struct MutexGuard<'a>(&'a glib_sys::GMutex);
|
||||
|
||||
impl<'a> MutexGuard<'a> {
|
||||
|
|
|
@ -103,6 +103,7 @@ unsafe impl<'a> Send for PadProbeData<'a> {}
|
|||
unsafe impl<'a> Sync for PadProbeData<'a> {}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[must_use = "if unused the StreamLock will immediately unlock"]
|
||||
pub struct StreamLock(Pad);
|
||||
impl Drop for StreamLock {
|
||||
fn drop(&mut self) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
use glib::translate::mut_override;
|
||||
use glib_sys;
|
||||
|
||||
#[must_use = "if unused the Mutex will immediately unlock"]
|
||||
pub struct MutexGuard<'a>(&'a glib_sys::GMutex);
|
||||
|
||||
impl<'a> MutexGuard<'a> {
|
||||
|
|
Loading…
Reference in a new issue