Results 1 to 7 of 7

Thread: Hints to design threaded serial-reader/writer interface ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Hints to design threaded serial-reader/writer interface ?

    Quote Originally Posted by oldFox64 View Post
    I know that the proper way to do this is with threads. I did another very similar project but in Java, which was easier for me thanks to a more complete API.
    Java is a bad example in this context, because it lacked asynchronous I/O for a long time and a lot if its APIs are still blocking by default.

    Qt, on the other hand, is primarily designed to be non-blocking, I/O being handled asynchronously (operation returning immediately, results being signalled).

    If you really must increase the complexity of your program then the approach suggested by stampede is usually the way to go.
    It allows everything to be tested with a single thread, etc.

    Cheers,
    _

  2. #2
    Join Date
    Feb 2014
    Posts
    15
    Thanks
    3

    Default Re: Hints to design threaded serial-reader/writer interface ?

    Now I discover that QBuffer's aren't usable for my case, as they only "grow" and don't remove data when they are been read.

    Which data structure should I use as a buffer if I want the buffer removes the data that has been read ?

    Something like this:
    Last edited by oldFox64; 5th May 2014 at 17:09.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Hints to design threaded serial-reader/writer interface ?

    Doesn't the internal buffer of the QIODevice already do that?

    Cheers,
    _

Similar Threads

  1. Replies: 2
    Last Post: 22nd September 2014, 05:25
  2. Seeking Suggestions for Multi-Threaded Application Design
    By swamyonline in forum Qt Programming
    Replies: 7
    Last Post: 1st May 2014, 17:19
  3. Replies: 12
    Last Post: 19th July 2012, 22:22
  4. Qt GUI interface like Adobe Acrobat Reader
    By indianinside in forum Qt Programming
    Replies: 14
    Last Post: 28th June 2012, 19:32
  5. Problem with design interface
    By tux-world in forum Newbie
    Replies: 5
    Last Post: 10th March 2010, 15:19

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.