commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r11444 - in gnuradio/trunk: config pmt pmt/src/lib


From: eb
Subject: [Commit-gnuradio] r11444 - in gnuradio/trunk: config pmt pmt/src/lib
Date: Tue, 14 Jul 2009 20:39:28 -0600 (MDT)

Author: eb
Date: 2009-07-14 20:39:28 -0600 (Tue, 14 Jul 2009)
New Revision: 11444

Modified:
   gnuradio/trunk/config/grc_pmt.m4
   gnuradio/trunk/pmt/pmt.pc.in
   gnuradio/trunk/pmt/src/lib/Makefile.am
   gnuradio/trunk/pmt/src/lib/pmt_pool.cc
   gnuradio/trunk/pmt/src/lib/pmt_pool.h
Log:
Removed pmt dependency on omnithreads, now dependent on boost::threads


Modified: gnuradio/trunk/config/grc_pmt.m4
===================================================================
--- gnuradio/trunk/config/grc_pmt.m4    2009-07-15 01:49:14 UTC (rev 11443)
+++ gnuradio/trunk/config/grc_pmt.m4    2009-07-15 02:39:28 UTC (rev 11444)
@@ -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 @@
     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

Modified: gnuradio/trunk/pmt/pmt.pc.in
===================================================================
--- gnuradio/trunk/pmt/pmt.pc.in        2009-07-15 01:49:14 UTC (rev 11443)
+++ gnuradio/trunk/pmt/pmt.pc.in        2009-07-15 02:39:28 UTC (rev 11444)
@@ -5,7 +5,7 @@
 
 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}

Modified: gnuradio/trunk/pmt/src/lib/Makefile.am
===================================================================
--- gnuradio/trunk/pmt/src/lib/Makefile.am      2009-07-15 01:49:14 UTC (rev 
11443)
+++ gnuradio/trunk/pmt/src/lib/Makefile.am      2009-07-15 02:39:28 UTC (rev 
11444)
@@ -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 @@
        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 =                      \

Modified: gnuradio/trunk/pmt/src/lib/pmt_pool.cc
===================================================================
--- gnuradio/trunk/pmt/src/lib/pmt_pool.cc      2009-07-15 01:49:14 UTC (rev 
11443)
+++ gnuradio/trunk/pmt/src/lib/pmt_pool.cc      2009-07-15 02:39:28 UTC (rev 
11444)
@@ -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 @@
 
 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 @@
 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 @@
   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();
 }

Modified: gnuradio/trunk/pmt/src/lib/pmt_pool.h
===================================================================
--- gnuradio/trunk/pmt/src/lib/pmt_pool.h       2009-07-15 01:49:14 UTC (rev 
11443)
+++ gnuradio/trunk/pmt/src/lib/pmt_pool.h       2009-07-15 02:39:28 UTC (rev 
11444)
@@ -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 @@
     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;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]