summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib
diff options
context:
space:
mode:
authorJohnathan Corgan2009-10-11 08:42:37 -0700
committerJohnathan Corgan2009-10-11 08:42:37 -0700
commitc49fc2debfbcbf6e8ab2100f7d20319b457792ee (patch)
tree8995da495bcd10e51842ada61fb62cf69c51b2e3 /gnuradio-core/src/lib
parenta1faa30ce3313e81e180792bea445fe0a961fe3c (diff)
parent58f84719a2084142bd2fe008a7ff4b1f05b5a598 (diff)
downloadgnuradio-c49fc2debfbcbf6e8ab2100f7d20319b457792ee.tar.gz
gnuradio-c49fc2debfbcbf6e8ab2100f7d20319b457792ee.tar.bz2
gnuradio-c49fc2debfbcbf6e8ab2100f7d20319b457792ee.zip
Merge branch 'patches/dward' of git@gnuradio.org:jcorgan
* 'patches/dward' of git@gnuradio.org:jcorgan: #include "config.h" in db_wbxng.cc (for timespec, nanosleep, etc.) Add flags and dependencies for MinGW/MSYS. Add dependence of gruel on guile; fixes ticket #410. Use gruel::mutex instead of pthread_mutex in gr_histo_sink_f. Add .gitattributes to fix CRLF problems on MinGW/MSYS
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r--gnuradio-core/src/lib/io/gr_histo_sink_f.cc11
-rw-r--r--gnuradio-core/src/lib/io/gr_histo_sink_f.h4
-rw-r--r--gnuradio-core/src/lib/missing/Makefile.am14
3 files changed, 16 insertions, 13 deletions
diff --git a/gnuradio-core/src/lib/io/gr_histo_sink_f.cc b/gnuradio-core/src/lib/io/gr_histo_sink_f.cc
index a923a7e45..2885fe428 100644
--- a/gnuradio-core/src/lib/io/gr_histo_sink_f.cc
+++ b/gnuradio-core/src/lib/io/gr_histo_sink_f.cc
@@ -53,7 +53,6 @@ gr_histo_sink_f::gr_histo_sink_f (gr_msg_queue_sptr msgq)
: gr_sync_block ("histo_sink_f", gr_make_io_signature (1, 1, sizeof (float)), gr_make_io_signature (0, 0, 0)),
d_msgq (msgq), d_num_bins(11), d_frame_size(1000), d_sample_count(0), d_bins(NULL), d_samps(NULL)
{
- pthread_mutex_init(&d_mutex, 0);
//allocate arrays and clear
set_num_bins(d_num_bins);
set_frame_size(d_frame_size);
@@ -61,7 +60,6 @@ gr_histo_sink_f::gr_histo_sink_f (gr_msg_queue_sptr msgq)
gr_histo_sink_f::~gr_histo_sink_f (void)
{
- pthread_mutex_destroy(&d_mutex);
delete [] d_samps;
delete [] d_bins;
}
@@ -72,7 +70,7 @@ gr_histo_sink_f::work (int noutput_items,
gr_vector_void_star &output_items)
{
const float *in = (const float *) input_items[0];
- pthread_mutex_lock(&d_mutex);
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
for (unsigned int i = 0; i < (unsigned int)noutput_items; i++){
d_samps[d_sample_count] = in[i];
d_sample_count++;
@@ -82,7 +80,6 @@ gr_histo_sink_f::work (int noutput_items,
clear();
}
}
- pthread_mutex_unlock(&d_mutex);
return noutput_items;
}
@@ -148,22 +145,20 @@ gr_histo_sink_f::get_num_bins(void){
**************************************************/
void
gr_histo_sink_f::set_frame_size(unsigned int frame_size){
- pthread_mutex_lock(&d_mutex);
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
d_frame_size = frame_size;
/* allocate a new sample array */
delete [] d_samps;
d_samps = new float[d_frame_size];
clear();
- pthread_mutex_unlock(&d_mutex);
}
void
gr_histo_sink_f::set_num_bins(unsigned int num_bins){
- pthread_mutex_lock(&d_mutex);
+ gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function
d_num_bins = num_bins;
/* allocate a new bin array */
delete [] d_bins;
d_bins = new unsigned int[d_num_bins];
clear();
- pthread_mutex_unlock(&d_mutex);
}
diff --git a/gnuradio-core/src/lib/io/gr_histo_sink_f.h b/gnuradio-core/src/lib/io/gr_histo_sink_f.h
index 640398c60..8ba45ec55 100644
--- a/gnuradio-core/src/lib/io/gr_histo_sink_f.h
+++ b/gnuradio-core/src/lib/io/gr_histo_sink_f.h
@@ -25,7 +25,7 @@
#include <gr_sync_block.h>
#include <gr_msg_queue.h>
-#include <pthread.h>
+#include <gruel/thread.h>
class gr_histo_sink_f;
typedef boost::shared_ptr<gr_histo_sink_f> gr_histo_sink_f_sptr;
@@ -45,7 +45,7 @@ private:
unsigned int d_sample_count;
unsigned int *d_bins;
float *d_samps;
- pthread_mutex_t d_mutex;
+ gruel::mutex d_mutex;
friend gr_histo_sink_f_sptr gr_make_histo_sink_f (gr_msg_queue_sptr msgq);
gr_histo_sink_f (gr_msg_queue_sptr msgq);
diff --git a/gnuradio-core/src/lib/missing/Makefile.am b/gnuradio-core/src/lib/missing/Makefile.am
index 08e521cb3..238370910 100644
--- a/gnuradio-core/src/lib/missing/Makefile.am
+++ b/gnuradio-core/src/lib/missing/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2003,2004,2008 Free Software Foundation, Inc.
+# Copyright 2003,2004,2008,2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -33,6 +33,14 @@ EXTRA_DIST = \
noinst_LTLIBRARIES = libmissing.la
-libmissing_la_SOURCES = \
- bug_work_around_8.cc \
+libmissing_la_common_SOURCES = \
+ bug_work_around_8.cc
+
+powerpc_CODE = \
posix_memalign.cc
+
+if MD_CPU_powerpc
+libmissing_la_SOURCES = $(libmissing_la_common_SOURCES) $(powerpc_CODE)
+else
+libmissing_la_SOURCES = $(libmissing_la_common_SOURCES)
+endif