]> sigrok.org Git - pulseview.git/commitdiff
Added empty decoder thread
authorJoel Holdsworth <redacted>
Wed, 3 Jul 2013 20:28:47 +0000 (21:28 +0100)
committerJoel Holdsworth <redacted>
Sun, 29 Sep 2013 01:52:22 +0000 (10:52 +0900)
pv/data/decoder.cpp
pv/data/decoder.h

index 65854ee056b9384c1c0a7a774de78ee9fdb3f1b3..e1be16e3ea14898fcea05f0f9f34b48d101e04c0 100644 (file)
@@ -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<data::Logic>());
+}
+
+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::Logic> data)
 {
+       (void)data;
 }
 
 } // namespace data
index c4f7115254141dc5f565960708c54ce47535d0a9..dcf12fe1d4b5d2b8c6696442682bc9f5217ea2e6 100644 (file)
@@ -26,6 +26,7 @@
 #include <map>
 
 #include <boost/shared_ptr.hpp>
+#include <boost/thread.hpp>
 
 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<const srd_probe*,
                        boost::shared_ptr<pv::view::Signal> > 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::Logic> data);
+
 private:
        const srd_decoder *const _decoder;
        std::map<const srd_probe*, boost::shared_ptr<view::Signal> >
                _probes;
 
        srd_decoder_inst *_decoder_inst;
+
+       boost::thread _decode_thread;
 };
 
 } // namespace data