From: Joel Holdsworth Date: Wed, 3 Jul 2013 20:28:47 +0000 (+0100) Subject: Added empty decoder thread X-Git-Tag: pulseview-0.2.0~305 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=640d69ce065e5c5a30e83395b259a63f7e03c779;p=pulseview.git Added empty decoder thread --- diff --git a/pv/data/decoder.cpp b/pv/data/decoder.cpp index 65854ee0..e1be16e3 100644 --- a/pv/data/decoder.cpp +++ b/pv/data/decoder.cpp @@ -40,11 +40,30 @@ Decoder::Decoder(const srd_decoder *const dec, init_decoder(); } +Decoder::~Decoder() +{ + _decode_thread.interrupt(); + _decode_thread.join(); +} + const srd_decoder* Decoder::get_decoder() const { return _decoder; } +void Decoder::begin_decode() +{ + _decode_thread.interrupt(); + _decode_thread.join(); + + _decode_thread = boost::thread(&Decoder::decode_proc, this, + shared_ptr()); +} + +void Decoder::clear_snapshots() +{ +} + void Decoder::init_decoder() { _decoder_inst = srd_inst_new(_decoder->id, NULL); @@ -67,8 +86,9 @@ void Decoder::init_decoder() srd_inst_probe_set_all(_decoder_inst, probes); } -void Decoder::clear_snapshots() +void Decoder::decode_proc(shared_ptr data) { + (void)data; } } // namespace data diff --git a/pv/data/decoder.h b/pv/data/decoder.h index c4f71152..dcf12fe1 100644 --- a/pv/data/decoder.h +++ b/pv/data/decoder.h @@ -26,6 +26,7 @@ #include #include +#include struct srd_decoder; struct srd_decoder_inst; @@ -39,6 +40,8 @@ class Signal; namespace data { +class Logic; + class Decoder : public SignalData { public: @@ -46,19 +49,27 @@ public: std::map > probes); + virtual ~Decoder(); + const srd_decoder* get_decoder() const; + void begin_decode(); + void clear_snapshots(); private: void init_decoder(); + void decode_proc(boost::shared_ptr data); + private: const srd_decoder *const _decoder; std::map > _probes; srd_decoder_inst *_decoder_inst; + + boost::thread _decode_thread; }; } // namespace data