summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnathan Corgan2011-03-14 19:52:00 -0700
committerJohnathan Corgan2011-03-14 19:52:00 -0700
commit90243cbeca81a47da7760247787546ac4ed722cb (patch)
treecb13f8b9b58f1d49a8f1285c63ce0002048734ad
parenta12b611f1fb5e409cefd311aa2537168e65d6f46 (diff)
parente73c25fb9226029f0e50052b1ffacedb3a78622b (diff)
downloadgnuradio-90243cbeca81a47da7760247787546ac4ed722cb.tar.gz
gnuradio-90243cbeca81a47da7760247787546ac4ed722cb.tar.bz2
gnuradio-90243cbeca81a47da7760247787546ac4ed722cb.zip
Merge remote branch 'jblum/mergeme/misc/gruel_thread_simplification' into next
* jblum/mergeme/misc/gruel_thread_simplification: gruel thread simplification:
-rw-r--r--gnuradio-core/src/lib/runtime/gr_buffer.h3
-rw-r--r--gruel/src/include/gruel/thread.h16
-rw-r--r--gruel/src/lib/Makefile.am1
-rw-r--r--gruel/src/lib/thread.cc35
-rw-r--r--usrp2/host/lib/control.cc6
5 files changed, 12 insertions, 49 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h
index aa26f1e09..e5725d386 100644
--- a/gnuradio-core/src/lib/runtime/gr_buffer.h
+++ b/gnuradio-core/src/lib/runtime/gr_buffer.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009,2010 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -27,6 +27,7 @@
#include <boost/weak_ptr.hpp>
#include <gruel/thread.h>
#include <gruel/pmt.h>
+#include <deque>
class gr_vmcircbuf;
diff --git a/gruel/src/include/gruel/thread.h b/gruel/src/include/gruel/thread.h
index d72e5520c..5a8ab1876 100644
--- a/gruel/src/include/gruel/thread.h
+++ b/gruel/src/include/gruel/thread.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2009,2010 Free Software Foundation, Inc.
+ * Copyright 2009,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -21,21 +21,17 @@
#ifndef INCLUDED_THREAD_H
#define INCLUDED_THREAD_H
-#include <boost/thread.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/locks.hpp>
+#include <boost/thread/condition_variable.hpp>
namespace gruel {
typedef boost::thread thread;
typedef boost::mutex mutex;
- typedef boost::unique_lock<boost::mutex> scoped_lock;
+ typedef boost::mutex::scoped_lock scoped_lock;
typedef boost::condition_variable condition_variable;
- typedef boost::posix_time::time_duration duration;
-
- /*!
- * Returns absolute time 'secs' into the future
- */
- boost::system_time get_new_timeout(double secs);
} /* namespace gruel */
diff --git a/gruel/src/lib/Makefile.am b/gruel/src/lib/Makefile.am
index b9b35ae10..f37ab27a1 100644
--- a/gruel/src/lib/Makefile.am
+++ b/gruel/src/lib/Makefile.am
@@ -45,7 +45,6 @@ MSG_LIB = msg/libmsg.la
libgruel_la_SOURCES = \
realtime.cc \
sys_pri.cc \
- thread.cc \
thread_body_wrapper.cc \
thread_group.cc
diff --git a/gruel/src/lib/thread.cc b/gruel/src/lib/thread.cc
deleted file mode 100644
index d8f77b506..000000000
--- a/gruel/src/lib/thread.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <gruel/thread.h>
-
-namespace gruel {
-
- boost::system_time
- get_new_timeout(double secs)
- {
- return boost::get_system_time() + boost::posix_time::milliseconds(long(secs*1e3));
- }
-
-}
diff --git a/usrp2/host/lib/control.cc b/usrp2/host/lib/control.cc
index 33a95c078..3b5533eb8 100644
--- a/usrp2/host/lib/control.cc
+++ b/usrp2/host/lib/control.cc
@@ -27,6 +27,9 @@
#include <iostream>
#include <gruel/thread.h>
+#include <boost/date_time/posix_time/posix_time.hpp>
+namespace pt = boost::posix_time;
+
namespace usrp2 {
pending_reply::pending_reply(unsigned int rid, void *buffer, size_t len)
@@ -44,10 +47,9 @@ namespace usrp2 {
pending_reply::wait_for_completion(double secs)
{
gruel::scoped_lock l(d_mutex);
- boost::system_time to(gruel::get_new_timeout(secs));
while (!d_complete) {
- if (!d_cond.timed_wait(l, to))
+ if (!d_cond.timed_wait(l, pt::milliseconds(long(secs*1e3))))
return 0; // timed out
}