diff options
author | eb | 2009-07-15 02:39:28 +0000 |
---|---|---|
committer | eb | 2009-07-15 02:39:28 +0000 |
commit | d4110d3f9ce3038a13051b00060004554636e48b (patch) | |
tree | 2b7f33bdc28a5228419815bcbcf964e27d39b7b9 | |
parent | 2e7c5c717a53aaa64ee46f154d5792e7118599ed (diff) | |
download | gnuradio-d4110d3f9ce3038a13051b00060004554636e48b.tar.gz gnuradio-d4110d3f9ce3038a13051b00060004554636e48b.tar.bz2 gnuradio-d4110d3f9ce3038a13051b00060004554636e48b.zip |
Removed pmt dependency on omnithreads, now dependent on boost::threads
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11444 221aa14e-8319-0410-a670-987f0aec2ac5
-rw-r--r-- | config/grc_pmt.m4 | 5 | ||||
-rw-r--r-- | pmt/pmt.pc.in | 4 | ||||
-rw-r--r-- | pmt/src/lib/Makefile.am | 8 | ||||
-rw-r--r-- | pmt/src/lib/pmt_pool.cc | 13 | ||||
-rw-r--r-- | pmt/src/lib/pmt_pool.h | 9 |
5 files changed, 18 insertions, 21 deletions
diff --git a/config/grc_pmt.m4 b/config/grc_pmt.m4 index 8e0a58bca..680acc9e4 100644 --- a/config/grc_pmt.m4 +++ b/config/grc_pmt.m4 @@ -1,4 +1,4 @@ -dnl Copyright 2001,2002,2003,2004,2005,2006,2008 Free Software Foundation, Inc. +dnl Copyright 2001,2002,2003,2004,2005,2006,2008,2009 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -21,9 +21,6 @@ AC_DEFUN([GRC_PMT],[ GRC_ENABLE(pmt) GRC_WITH(pmt) - dnl Don't do pmt if omnithread skipped - GRC_CHECK_DEPENDENCY(pmt, omnithread) - dnl If execution gets to here, $passed will be: dnl with : if the --with code didn't error out dnl yes : if the --enable code passed muster and all dependencies are met diff --git a/pmt/pmt.pc.in b/pmt/pmt.pc.in index d6628cad6..b2f86ea65 100644 --- a/pmt/pmt.pc.in +++ b/pmt/pmt.pc.in @@ -5,7 +5,7 @@ includedir=@includedir@ Name: pmt Description: The GNU Radio Polymorphic Type library -Requires: gnuradio-omnithread +Requires: Version: @VERSION@ Libs: -L${libdir} -lpmt -Cflags: -I${includedir}
\ No newline at end of file +Cflags: -I${includedir} diff --git a/pmt/src/lib/Makefile.am b/pmt/src/lib/Makefile.am index 32e5210d5..a510f4e0b 100644 --- a/pmt/src/lib/Makefile.am +++ b/pmt/src/lib/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2006,2008 Free Software Foundation, Inc. +# Copyright 2006,2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,7 +21,7 @@ include $(top_srcdir)/Makefile.common -AM_CPPFLAGS = $(DEFINES) $(OMNITHREAD_INCLUDES) $(BOOST_CPPFLAGS) \ +AM_CPPFLAGS = $(DEFINES) $(BOOST_CPPFLAGS) \ $(CPPUNIT_INCLUDES) $(WITH_INCLUDES) TESTS = test_pmt @@ -63,11 +63,11 @@ libpmt_la_SOURCES = \ pmt_unv.cc # magic flags -libpmt_la_LDFLAGS = $(NO_UNDEFINED) +libpmt_la_LDFLAGS = $(NO_UNDEFINED) $(BOOST_LDFLAGS) # link the library against the c++ standard library libpmt_la_LIBADD = \ - $(OMNITHREAD_LA) \ + $(BOOST_THREAD_LIB) \ -lstdc++ include_HEADERS = \ diff --git a/pmt/src/lib/pmt_pool.cc b/pmt/src/lib/pmt_pool.cc index 05d9c005b..05a7f5900 100644 --- a/pmt/src/lib/pmt_pool.cc +++ b/pmt/src/lib/pmt_pool.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007 Free Software Foundation, Inc. + * Copyright 2007,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -34,8 +34,7 @@ ROUNDUP(size_t x, size_t stride) pmt_pool::pmt_pool(size_t itemsize, size_t alignment, size_t allocation_size, size_t max_items) - : d_cond(&d_mutex), - d_itemsize(ROUNDUP(itemsize, alignment)), + : d_itemsize(ROUNDUP(itemsize, alignment)), d_alignment(alignment), d_allocation_size(std::max(allocation_size, 16 * itemsize)), d_max_items(max_items), d_n_items(0), @@ -53,12 +52,12 @@ pmt_pool::~pmt_pool() void * pmt_pool::malloc() { - omni_mutex_lock l(d_mutex); + scoped_lock guard(d_mutex); item *p; if (d_max_items != 0){ while (d_n_items >= d_max_items) - d_cond.wait(); + d_cond.wait(guard); } if (d_freelist){ // got something? @@ -98,12 +97,12 @@ pmt_pool::free(void *foo) if (!foo) return; - omni_mutex_lock l(d_mutex); + scoped_lock guard(d_mutex); item *p = (item *) foo; p->d_next = d_freelist; d_freelist = p; d_n_items--; if (d_max_items != 0) - d_cond.signal(); + d_cond.notify_one(); } diff --git a/pmt/src/lib/pmt_pool.h b/pmt/src/lib/pmt_pool.h index dd63d44a6..8004a65e4 100644 --- a/pmt/src/lib/pmt_pool.h +++ b/pmt/src/lib/pmt_pool.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2007 Free Software Foundation, Inc. + * Copyright 2007,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -22,8 +22,8 @@ #define INCLUDED_PMT_POOL_H #include <cstddef> -#include <gnuradio/omnithread.h> #include <vector> +#include <boost/thread.hpp> /*! * \brief very simple thread-safe fixed-size allocation pool @@ -37,8 +37,9 @@ class pmt_pool { struct item *d_next; }; - omni_mutex d_mutex; - omni_condition d_cond; + typedef boost::unique_lock<boost::mutex> scoped_lock; + mutable boost::mutex d_mutex; + boost::condition_variable d_cond; size_t d_itemsize; size_t d_alignment; |