GNU Radio's TEST Package
fifo.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2013-2021 Sylvain Munaut <tnt@246tNt.com>
4  *
5  * This file is part of gr-fosphor
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  */
9 
10 #pragma once
11 
12 #include <gnuradio/fosphor/api.h>
13 
14 #include <gnuradio/gr_complex.h>
15 #include <gnuradio/thread/thread.h>
16 
17 namespace gr {
18  namespace fosphor {
19 
21  {
22  private:
23  gr_complex *d_buf;
24  int d_len;
25  int d_rp;
26  int d_wp;
27 
28  thread::mutex d_mutex;
29  thread::condition_variable d_cond_empty;
30  thread::condition_variable d_cond_full;
31 
32  public:
33  fifo(int length);
34  ~fifo();
35 
36  int free();
37  int used();
38 
40  gr_complex *write_prepare(int size, bool wait=true);
41  void write_commit(int size);
42 
44  gr_complex *read_peek(int size, bool wait=true);
45  void read_discard(int size);
46  };
47 
48  } // namespace fosphor
49 } // namespace gr
#define GR_FOSPHOR_API
Definition: api.h:17
Definition: fifo.h:21
gr_complex * read_peek(int size, bool wait=true)
void write_commit(int size)
fifo(int length)
void read_discard(int size)
gr_complex * write_prepare(int size, bool wait=true)
Definition: base_sink_c.h:17
Definition: private.h:31