-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
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
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}
#
-# Copyright 2006,2008 Free Software Foundation, Inc.
+# Copyright 2006,2008,2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
include $(top_srcdir)/Makefile.common
-AM_CPPFLAGS = $(DEFINES) $(OMNITHREAD_INCLUDES) $(BOOST_CPPFLAGS) \
+AM_CPPFLAGS = $(DEFINES) $(BOOST_CPPFLAGS) \
$(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
TESTS = test_pmt
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 = \
/* -*- c++ -*- */
/*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2007,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
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),
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?
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();
}
/* -*- c++ -*- */
/*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2007,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
#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
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;