Multi Threading



  • Hi guys

    Just want your suggestions...
    I am trying to fetch data from a serial port (not using QSerialport)
    When I am doing this in single thread some data loss is their because I am reading 23 bytes at once and checking its start byte and stop byte and number of bytes and if condition fails I am discarding the packet … and its a time driven operation I am using timers to call a function which is doing this operation.

    So now what I am going to do is I ll seprate reading logic and packet identification logic in two separate threads. I ll push packets in a buffer(queue ) and I ll read that buffer and put some logic so that I can handle this data packet thing efficiently.

    I am not having much idea about Multithreading so I have tried a small example of multithreading using run() method .

    But I need some suggestions in how many ways I can create threads and what approach I should take.

    Thanks
    Ashish


  • Qt Champions 2017

    You can use use following mechanism to work with threads.

    1. Create the object
    2. Move the the object to new thread using moveToThread
    3. Use started() signal thread to connect with slot


  • @dheerendra ok sir I ll try this.


Log in to reply