commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r6190 - gnuradio/branches/developers/eb/fg/gnuradio-co


From: eb
Subject: [Commit-gnuradio] r6190 - gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime
Date: Mon, 27 Aug 2007 16:08:45 -0600 (MDT)

Author: eb
Date: 2007-08-27 16:08:44 -0600 (Mon, 27 Aug 2007)
New Revision: 6190

Modified:
   
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_scheduler_thread.cc
   
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc
   
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h
   
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
   
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc
   
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/qa_gr_top_block.h
Log:
work-in-progress on debugging hang.  Now hangs in t3_lock_unlock ;)

Modified: 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_scheduler_thread.cc
===================================================================
--- 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_scheduler_thread.cc
     2007-08-27 20:38:44 UTC (rev 6189)
+++ 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_scheduler_thread.cc
     2007-08-27 22:08:44 UTC (rev 6190)
@@ -31,7 +31,7 @@
 #include <signal.h>
 #endif
 
-#define GR_SCHEDULER_THREAD_DEBUG 0
+#define GR_SCHEDULER_THREAD_DEBUG 1
 
 gr_scheduler_thread::gr_scheduler_thread(gr_block_vector_t graph) :
   omni_thread(NULL, PRIORITY_NORMAL),
@@ -45,6 +45,9 @@
 
 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 @@
 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();
 }

Modified: 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc
===================================================================
--- 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc
    2007-08-27 20:38:44 UTC (rev 6189)
+++ 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.cc
    2007-08-27 22:08:44 UTC (rev 6190)
@@ -86,6 +86,14 @@
   main_loop ();
 }
 
+void
+gr_single_threaded_scheduler::stop ()
+{ 
+  if (1)
+    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)

Modified: 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h
===================================================================
--- 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h
     2007-08-27 20:38:44 UTC (rev 6189)
+++ 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_single_threaded_scheduler.h
     2007-08-27 22:08:44 UTC (rev 6190)
@@ -40,7 +40,7 @@
   ~gr_single_threaded_scheduler ();
 
   void run ();
-  void stop () { d_enabled = false; }
+  void stop ();
 
  private:
   const std::vector<gr_block_sptr>     d_blocks;

Modified: 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
===================================================================
--- 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
       2007-08-27 20:38:44 UTC (rev 6189)
+++ 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
       2007-08-27 22:08:44 UTC (rev 6190)
@@ -33,7 +33,7 @@
 #include <stdexcept>
 #include <iostream>
 
-#define GR_TOP_BLOCK_IMPL_DEBUG 0
+#define GR_TOP_BLOCK_IMPL_DEBUG 1
 
 static gr_top_block_impl *s_impl = 0;
 
@@ -167,7 +167,7 @@
 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--;

Modified: 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc
===================================================================
--- 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc
 2007-08-27 20:38:44 UTC (rev 6189)
+++ 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/qa_gr_top_block.cc
 2007-08-27 22:08:44 UTC (rev 6190)
@@ -30,8 +30,16 @@
 #include <gr_null_source.h>
 #include <gr_null_sink.h>
 
+#define VERBOSE 1
+
+#if (VERBOSE)
+#include <iostream>
+#endif
+
 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 +47,12 @@
 
 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), 1000000);
   gr_block_sptr dst = gr_make_null_sink(sizeof(int));
 
   tb->connect(src, 0, head, 0);
@@ -52,6 +62,8 @@
 
 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));
@@ -66,8 +78,17 @@
   tb->wait();
 }
 
+#if 0
+/*
+ * This test case is indeterminate.  There is a race.
+ * There is no guarantee that the graph hasn't already
+ * completed (because of the head) before the lock/unlock
+ * sequence is executed.
+ */
 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));
@@ -82,12 +103,38 @@
   tb->lock();
   tb->unlock();
 
+  // tb->stop();
+  tb->wait();
+}
+
+#else
+
+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 dst = gr_make_null_sink(sizeof(int));
+
+  tb->connect(src, 0, dst, 0);
+
+  tb->start();
+
+  tb->lock();
+  tb->unlock();
+
   tb->stop();
   tb->wait();
 }
+#endif
 
+
 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));

Modified: 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/qa_gr_top_block.h
===================================================================
--- 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/qa_gr_top_block.h
  2007-08-27 20:38:44 UTC (rev 6189)
+++ 
gnuradio/branches/developers/eb/fg/gnuradio-core/src/lib/runtime/qa_gr_top_block.h
  2007-08-27 22:08:44 UTC (rev 6190)
@@ -35,7 +35,7 @@
   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();
 





reply via email to

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