diff --git a/Makefile b/Makefile index 668d318..c9bafbe 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ PARAMS_MISC = -Wno-unused-result FFTW_PACKAGE = fftw-3.3.3 .PHONY: clean-vect clean -all: csdr ddcd +all: csdr nmux libcsdr.so: fft_fftw.c fft_rpi.c libcsdr_wrapper.c libcsdr.c libcsdr_gpl.c fastddc.c fastddc.h fft_fftw.h fft_rpi.h ima_adpcm.h libcsdr_gpl.h libcsdr.h predefined.h @echo NOTE: you may have to manually edit Makefile to optimize for your CPU \(especially if you compile on ARM, please edit PARAMS_NEON\). @echo Auto-detected optimization parameters: $(PARAMS_SIMD) diff --git a/nmux.cpp b/nmux.cpp index 2f86278..0b093b4 100644 --- a/nmux.cpp +++ b/nmux.cpp @@ -28,7 +28,7 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "tsmpool.h" +#include "nmux.h" int host_port = 0; char host_address[100] = "127.0.0.1"; @@ -38,7 +38,7 @@ int thread_cntr = 0; int bufsize = 1024; //! currently unused int bufcnt = 1024; -char* global_argv; +char** global_argv; int global_argc; tsmpool* pool; @@ -150,8 +150,9 @@ int main(int argc, char* argv[]) unsigned char* current_write_buffer = pool->get_write_buffer(); int index_in_current_write_buffer = 0; - pthread_cond_t* wait_condition = new wait_condition; - pthread_cond_init(wait_condition, NULL); + pthread_cond_t* wait_condition = new pthread_cond_t; + if(!pthread_cond_init(wait_condition, NULL)) + print_exit(MSG_START "pthread_cond_init failed"); //cond_attrs is ignored by Linux for(;;) { @@ -181,7 +182,6 @@ int main(int argc, char* argv[]) } else { - fprintf(stderr, MSG_START "pthread_create() failed.\n"); } } diff --git a/nmux.h b/nmux.h index 886baf2..cb8df09 100644 --- a/nmux.h +++ b/nmux.h @@ -1,5 +1,9 @@ #include -#include +#include +#include +#include +#include +#include "tsmpool.h" #define MSG_START "nmux: " diff --git a/tsmpool.h b/tsmpool.h index e89d965..f207689 100644 --- a/tsmpool.h +++ b/tsmpool.h @@ -3,6 +3,10 @@ //It implements a big circular buffer that one thread writes into, and multiple threads read from. //The reader threads have lower priority than the writer thread (they can be left behind if the don't read fast enough). +#include + +using namespace std; + typedef struct tsmthread_s { int read_index; //it always points to the next buffer to be read @@ -31,4 +35,4 @@ public: void* get_read_buffer(tsmthread_t* thread); int index_next(int index) { return (index+1==size)?0:index; } int index_before(int index) { return (index-1<0)?size-1:index; } -} +};