diff options
Diffstat (limited to 'gnuradio-core/src/lib')
-rw-r--r-- | gnuradio-core/src/lib/io/gr_file_source.cc | 10 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_debug.cc | 11 | ||||
-rw-r--r-- | gnuradio-core/src/lib/io/gr_message_debug.h | 13 | ||||
-rw-r--r-- | gnuradio-core/src/lib/runtime/gr_block_registry.h | 1 |
4 files changed, 25 insertions, 10 deletions
diff --git a/gnuradio-core/src/lib/io/gr_file_source.cc b/gnuradio-core/src/lib/io/gr_file_source.cc index 09f3986cd..f3def0721 100644 --- a/gnuradio-core/src/lib/io/gr_file_source.cc +++ b/gnuradio-core/src/lib/io/gr_file_source.cc @@ -89,7 +89,7 @@ gr_file_source::work (int noutput_items, if(d_fp == NULL) throw std::runtime_error("work with file not open"); - boost::mutex::scoped_lock lock(fp_mutex); // hold for the rest of this function + gruel::scoped_lock lock(fp_mutex); // hold for the rest of this function while (size) { i = fread(o, d_itemsize, size, (FILE *) d_fp); @@ -129,7 +129,7 @@ bool gr_file_source::seek (long seek_point, int whence) { // obtain exclusive access for duration of this function - boost::mutex::scoped_lock lock(fp_mutex); + gruel::scoped_lock lock(fp_mutex); return fseek((FILE *) d_fp, seek_point * d_itemsize, whence) == 0; } @@ -137,7 +137,7 @@ void gr_file_source::open(const char *filename, bool repeat) { // obtain exclusive access for duration of this function - boost::mutex::scoped_lock lock(fp_mutex); + gruel::scoped_lock lock(fp_mutex); int fd; @@ -166,7 +166,7 @@ void gr_file_source::close() { // obtain exclusive access for duration of this function - boost::mutex::scoped_lock lock(fp_mutex); + gruel::scoped_lock lock(fp_mutex); if(d_new_fp != NULL) { fclose(d_new_fp); @@ -179,7 +179,7 @@ void gr_file_source::do_update() { if(d_updated) { - boost::mutex::scoped_lock lock(fp_mutex); // hold while in scope + gruel::scoped_lock lock(fp_mutex); // hold while in scope if(d_fp) fclose(d_fp); diff --git a/gnuradio-core/src/lib/io/gr_message_debug.cc b/gnuradio-core/src/lib/io/gr_message_debug.cc index 27f4c65fd..9eb1bb639 100644 --- a/gnuradio-core/src/lib/io/gr_message_debug.cc +++ b/gnuradio-core/src/lib/io/gr_message_debug.cc @@ -59,10 +59,10 @@ gr_message_debug::store(pmt::pmt_t msg) } void -gr_message_debug::print_verbose(pmt::pmt_t msg) +gr_message_debug::print_pdu(pmt::pmt_t pdu) { - pmt::pmt_t meta = pmt::pmt_car(msg); - pmt::pmt_t vector = pmt::pmt_cdr(msg); + pmt::pmt_t meta = pmt::pmt_car(pdu); + pmt::pmt_t vector = pmt::pmt_cdr(pdu); std::cout << "* MESSAGE DEBUG PRINT PDU VERBOSE *\n"; pmt::pmt_print(meta); size_t len = pmt::pmt_length(vector); @@ -71,7 +71,7 @@ gr_message_debug::print_verbose(pmt::pmt_t msg) size_t offset(0); const uint8_t* d = (const uint8_t*) pmt_uniform_vector_elements(vector, offset); for(size_t i=0; i<len; i+=16){ - printf("%04x: ", i); + printf("%04x: ", ((unsigned int)i)); for(size_t j=i; j<std::min(i+16,len); j++){ printf("%02x ",d[j] ); } @@ -110,6 +110,9 @@ gr_message_debug::gr_message_debug() message_port_register_in(pmt::mp("store")); set_msg_handler(pmt::mp("store"), boost::bind(&gr_message_debug::store, this, _1)); + + message_port_register_in(pmt::mp("print_pdu")); + set_msg_handler(pmt::mp("print_pdu"), boost::bind(&gr_message_debug::print_pdu, this, _1)); } gr_message_debug::~gr_message_debug() diff --git a/gnuradio-core/src/lib/io/gr_message_debug.h b/gnuradio-core/src/lib/io/gr_message_debug.h index 6e6e5103c..f1374e806 100644 --- a/gnuradio-core/src/lib/io/gr_message_debug.h +++ b/gnuradio-core/src/lib/io/gr_message_debug.h @@ -55,7 +55,18 @@ class GR_CORE_API gr_message_debug : public gr_block * \param msg A pmt message passed from the scheduler's message handling. */ void print(pmt::pmt_t msg); - void print_verbose(pmt::pmt_t msg); + + /*! + * \brief PDU formatted messages received in this port are printed to stdout. + * + * This port receives messages from the scheduler's message handling + * mechanism and prints it to stdout. This message handler function + * is only meant to be used by the scheduler to handle messages + * posted to port 'print'. + * + * \param pdu A PDU message passed from the scheduler's message handling. + */ + void print_pdu(pmt::pmt_t pdu); /*! * \brief Messages received in this port are stored in a vector. diff --git a/gnuradio-core/src/lib/runtime/gr_block_registry.h b/gnuradio-core/src/lib/runtime/gr_block_registry.h index 6a2d939e5..3a9d9868f 100644 --- a/gnuradio-core/src/lib/runtime/gr_block_registry.h +++ b/gnuradio-core/src/lib/runtime/gr_block_registry.h @@ -2,6 +2,7 @@ #define GR_BLOCK_REGISTRY_H #include <map> +#include <gr_basic_block.h> #ifndef GR_BASIC_BLOCK_H class gr_basic_block; |