Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  threaded_mainloop.rs

  Sprache: Rust
 

// Copyright © 2017 Mozilla Foundation
//
// This program is made available under an ISC-style license.  See the
// accompanying file LICENSE for details.

use ffi;
use mainloop_api;
use mainloop_api::MainloopApi;
use ErrorCode;
use Result;

#[derive(Debug)]
pub struct ThreadedMainloop(*mut ffi::pa_threaded_mainloop);

impl ThreadedMainloop {
    pub unsafe fn from_raw_ptr(raw: *mut ffi::pa_threaded_mainloop) -> Self {
        ThreadedMainloop(raw)
    }

    pub fn new() -> Self {
        unsafe { ThreadedMainloop::from_raw_ptr(ffi::pa_threaded_mainloop_new()) }
    }

    pub fn raw_mut(&self) -> &mut ffi::pa_threaded_mainloop {
        unsafe { &mut *self.0 }
    }

    pub fn is_null(&self) -> bool {
        self.0.is_null()
    }

    pub fn start(&self) -> Result<()> {
        match unsafe { ffi::pa_threaded_mainloop_start(self.raw_mut()) } {
            0 => Ok(()),
            _ => Err(ErrorCode::from_error_code(ffi::PA_ERR_UNKNOWN)),
        }
    }

    pub fn stop(&self) {
        unsafe {
            ffi::pa_threaded_mainloop_stop(self.raw_mut());
        }
    }

    pub fn lock(&self) {
        unsafe {
            ffi::pa_threaded_mainloop_lock(self.raw_mut());
        }
    }

    pub fn unlock(&self) {
        unsafe {
            ffi::pa_threaded_mainloop_unlock(self.raw_mut());
        }
    }

    pub fn wait(&self) {
        unsafe {
            ffi::pa_threaded_mainloop_wait(self.raw_mut());
        }
    }

    pub fn signal(&self) {
        unsafe {
            ffi::pa_threaded_mainloop_signal(self.raw_mut(), 0);
        }
    }

    pub fn get_api(&self) -> MainloopApi {
        unsafe { mainloop_api::from_raw_ptr(ffi::pa_threaded_mainloop_get_api(self.raw_mut())) }
    }

    pub fn in_thread(&self) -> bool {
        unsafe { ffi::pa_threaded_mainloop_in_thread(self.raw_mut()) != 0 }
    }
}

impl ::std::default::Default for ThreadedMainloop {
    fn default() -> Self {
        ThreadedMainloop(::std::ptr::null_mut())
    }
}

impl ::std::ops::Drop for ThreadedMainloop {
    fn drop(&mut self) {
        if !self.is_null() {
            unsafe {
                ffi::pa_threaded_mainloop_free(self.raw_mut());
            }
        }
    }
}

Messung V0.5 in Prozent
C=96 H=72 G=84

¤ Dauer der Verarbeitung: 0.9 Sekunden  (vorverarbeitet am  2026-06-20) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik