summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/lib/runtime
diff options
context:
space:
mode:
authoreb2007-08-28 05:59:31 +0000
committereb2007-08-28 05:59:31 +0000
commit02cd43b565615593f90bd08eb4e718a6ee649661 (patch)
tree647dfca3951ba3297ed2e8f520caa03b0cb00b87 /gnuradio-core/src/lib/runtime
parentc088a546ac7ae55748e5421201f3387f3e1286f9 (diff)
downloadgnuradio-02cd43b565615593f90bd08eb4e718a6ee649661.tar.gz
gnuradio-02cd43b565615593f90bd08eb4e718a6ee649661.tar.bz2
gnuradio-02cd43b565615593f90bd08eb4e718a6ee649661.zip
Kludged around hang in hier_block2. Merged -r6189:6191 from eb/fg
into trunk. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6193 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-core/src/lib/runtime')
-rw-r--r--gnuradio-core/src/lib/runtime/gr_scheduler_thread.cc6
-rw-r--r--gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc10
-rw-r--r--gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h2
-rw-r--r--gnuradio-core/src/lib/runtime/gr_top_block_impl.cc2
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_top_block.cc23
-rw-r--r--gnuradio-core/src/lib/runtime/qa_gr_top_block.h2
6 files changed, 34 insertions, 11 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_scheduler_thread.cc b/gnuradio-core/src/lib/runtime/gr_scheduler_thread.cc
index 9cce5eaec..16f36ac56 100644
--- a/gnuradio-core/src/lib/runtime/gr_scheduler_thread.cc
+++ b/gnuradio-core/src/lib/runtime/gr_scheduler_thread.cc
@@ -45,6 +45,9 @@ gr_scheduler_thread::~gr_scheduler_thread()
void gr_scheduler_thread::start()
{
+ if (GR_SCHEDULER_THREAD_DEBUG)
+ std::cout << "gr_scheduler_thread::start() "
+ << this << std::endl;
start_undetached();
}
@@ -70,6 +73,7 @@ void
gr_scheduler_thread::stop()
{
if (GR_SCHEDULER_THREAD_DEBUG)
- std::cout << "gr_scheduler_thread::stop()" << std::endl;
+ std::cout << "gr_scheduler_thread::stop() "
+ << this << std::endl;
d_sts->stop();
}
diff --git a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc
index 6aaaf954b..b2fbdb73b 100644
--- a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc
+++ b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc
@@ -82,10 +82,18 @@ gr_single_threaded_scheduler::~gr_single_threaded_scheduler ()
void
gr_single_threaded_scheduler::run ()
{
- d_enabled = true;
+ // d_enabled = true; // KLUDGE
main_loop ();
}
+void
+gr_single_threaded_scheduler::stop ()
+{
+ if (0)
+ std::cout << "gr_singled_threaded_scheduler::stop() "
+ << this << std::endl;
+ d_enabled = false;
+}
inline static unsigned int
round_up (unsigned int n, unsigned int multiple)
diff --git a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h
index 139e50b13..060d3017d 100644
--- a/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h
+++ b/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h
@@ -40,7 +40,7 @@ class gr_single_threaded_scheduler {
~gr_single_threaded_scheduler ();
void run ();
- void stop () { d_enabled = false; }
+ void stop ();
private:
const std::vector<gr_block_sptr> d_blocks;
diff --git a/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc b/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
index f0b67ddde..679654077 100644
--- a/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
+++ b/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
@@ -167,7 +167,7 @@ void
gr_top_block_impl::unlock()
{
omni_mutex_lock lock(d_reconf);
- if (d_lock_count == 0)
+ if (d_lock_count <= 0)
throw std::runtime_error("unpaired unlock() call");
d_lock_count--;
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc b/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc
index 3322b6ac4..52677f0de 100644
--- a/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc
+++ b/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc
@@ -29,9 +29,14 @@
#include <gr_head.h>
#include <gr_null_source.h>
#include <gr_null_sink.h>
+#include <iostream>
+
+#define VERBOSE 0
void qa_gr_top_block::t0()
{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t0()\n";
+
gr_top_block_sptr tb = gr_make_top_block("top");
CPPUNIT_ASSERT(tb);
@@ -39,10 +44,12 @@ void qa_gr_top_block::t0()
void qa_gr_top_block::t1_run()
{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t1()\n";
+
gr_top_block_sptr tb = gr_make_top_block("top");
gr_block_sptr src = gr_make_null_source(sizeof(int));
- gr_block_sptr head = gr_make_head(sizeof(int), 1);
+ gr_block_sptr head = gr_make_head(sizeof(int), 100000);
gr_block_sptr dst = gr_make_null_sink(sizeof(int));
tb->connect(src, 0, head, 0);
@@ -52,10 +59,12 @@ void qa_gr_top_block::t1_run()
void qa_gr_top_block::t2_start_stop_wait()
{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t2()\n";
+
gr_top_block_sptr tb = gr_make_top_block("top");
gr_block_sptr src = gr_make_null_source(sizeof(int));
- gr_block_sptr head = gr_make_head(sizeof(int), 1000000);
+ gr_block_sptr head = gr_make_head(sizeof(int), 100000);
gr_block_sptr dst = gr_make_null_sink(sizeof(int));
tb->connect(src, 0, head, 0);
@@ -68,14 +77,14 @@ void qa_gr_top_block::t2_start_stop_wait()
void qa_gr_top_block::t3_lock_unlock()
{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t3()\n";
+
gr_top_block_sptr tb = gr_make_top_block("top");
gr_block_sptr src = gr_make_null_source(sizeof(int));
- gr_block_sptr head = gr_make_head(sizeof(int), 1000000);
gr_block_sptr dst = gr_make_null_sink(sizeof(int));
- tb->connect(src, 0, head, 0);
- tb->connect(head, 0, dst, 0);
+ tb->connect(src, 0, dst, 0);
tb->start();
@@ -88,10 +97,12 @@ void qa_gr_top_block::t3_lock_unlock()
void qa_gr_top_block::t4_reconfigure()
{
+ if (VERBOSE) std::cout << "qa_gr_top_block::t4()\n";
+
gr_top_block_sptr tb = gr_make_top_block("top");
gr_block_sptr src = gr_make_null_source(sizeof(int));
- gr_block_sptr head = gr_make_head(sizeof(int), 1);
+ gr_block_sptr head = gr_make_head(sizeof(int), 100000);
gr_block_sptr dst = gr_make_null_sink(sizeof(int));
// Start infinite flowgraph
diff --git a/gnuradio-core/src/lib/runtime/qa_gr_top_block.h b/gnuradio-core/src/lib/runtime/qa_gr_top_block.h
index 9a243452d..278b5ffb4 100644
--- a/gnuradio-core/src/lib/runtime/qa_gr_top_block.h
+++ b/gnuradio-core/src/lib/runtime/qa_gr_top_block.h
@@ -35,7 +35,7 @@ class qa_gr_top_block : public CppUnit::TestCase
CPPUNIT_TEST(t1_run);
CPPUNIT_TEST(t2_start_stop_wait);
CPPUNIT_TEST(t3_lock_unlock);
- // CPPUNIT_TEST(t4_reconfigure); triggers 'join never returns' bug
+ CPPUNIT_TEST(t4_reconfigure); // triggers 'join never returns' bug
CPPUNIT_TEST_SUITE_END();