pub fn from_states(s1: T, s2: T, s3: T) -> (TripleBufferReader<T>, TripleBufferWriter<T>) {
        // construct the actual buffer
        let state = Self {
            states: [Mutex::new(s1), Mutex::new(s2), Mutex::new(s3)],
            config: AtomicU32::new(TripleConfig::default().into()),
        };

        let state = Arc::new(state);

        // create a reader that can be passed to the read thread
        let read = TripleBufferReader {
            inner: Arc::clone(&state),
        };

        // create a writer that can be passed to the write thread
        let write = TripleBufferWriter {
            inner: Arc::clone(&state),
        };

        // only return the reader and writer, so that the different threads
        // will not be able to perform the wrong operation
        // the buffer will be dropped when both the reader and the writer
        // are dropped

        (read, write)
    }
/// Construct a new triple buffer from three different initial states.
/// There is no guarantee as to which order the states passed
/// will be used in, so it is recomended that the states are all
/// identical
Construct a new triple buffer from three different initial states.
There is no guarantee as to which order the states passed
will be used in, so it is recomended that the states are all
identical
Construct a new triple buffer from three different initial states . There is no guarantee as to which order the states passed will be used in so it is recomended that the states are all identical
pub fn from_states(s1: T, s2: T, s3: T) -> (TripleBufferReader<T>, TripleBufferWriter<T>) {
        // construct the actual buffer
        let state = Self {
            states: [Mutex::new(s1), Mutex::new(s2), Mutex::new(s3)],
            config: AtomicU32::new(TripleConfig::default().into()),
        };
        let state = Arc::new(state);
        // create a reader that can be passed to the read thread
        let read = TripleBufferReader {
            inner: Arc::clone(&state),
        };
        // create a writer that can be passed to the write thread
        let write = TripleBufferWriter {
            inner: Arc::clone(&state),
        };
        // only return the reader and writer, so that the different threads
        // will not be able to perform the wrong operation
        // the buffer will be dropped when both the reader and the writer
        // are dropped
        (read, write)
    }
pub fn from_states ( s1 : T , s2 : T , s3 : T ) -> ( TripleBufferReader < T > , TripleBufferWriter < T > ) { // construct the actual buffer let state = Self { states : [ Mutex :: new ( s1 ) , Mutex :: new ( s2 ) , Mutex :: new ( s3 ) ] , config : AtomicU32 :: new ( TripleConfig :: default ( ) . into ( ) ) , } ; let state = Arc :: new ( state ) ; // create a reader that can be passed to the read thread let read = TripleBufferReader { inner : Arc :: clone ( & state ) , } ; // create a writer that can be passed to the write thread let write = TripleBufferWriter { inner : Arc :: clone ( & state ) , } ; // only return the reader and writer, so that the different threads // will not be able to perform the wrong operation // the buffer will be dropped when both the reader and the writer // are dropped ( read , write ) }
Construct a new triple buffer from three different initial states.
Construct a new triple buffer from three different initial states .
s1
T
s2
T
s3
T
s1
T
s2
T
s3
T