#include <gr_block.h>
#include <gr_block_detail.h>
#include <gr_buffer.h>
+#include <boost/thread.hpp>
#include <iostream>
#include <limits>
#include <assert.h>
static int which_scheduler = 0;
-
-std::ostream&
-operator << (std::ostream& os, const gr_block *m)
-{
- os << "<gr_block " << m->name() << " (" << m->unique_id() << ")>";
- return os;
-}
-
gr_single_threaded_scheduler_sptr
gr_make_single_threaded_scheduler (const std::vector<gr_block_sptr> &blocks)
{
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)
nalive = d_blocks.size ();
while (d_enabled && nalive > 0){
+ if (boost::this_thread::interruption_requested())
+ break;
+
gr_block *m = d_blocks[bi].get ();
gr_block_detail *d = m->detail().get ();