Results 1 to 2 of 2

Thread: Any Multithreading specialist?

  1. #1

    Default Any Multithreading specialist?

    Hi I just have start with QT just to make a oscilloscope program for my micro-controller. The program should read continuously port and displaying values on the screen,so first I tried with just one,the main thread but as predicted it was just freezing.
    OK so I have now one special thread just for this.

    There is two buffers of size 500.
    One semaphor that is directing whether one or the other buffer can read main or second thread.

    So the main thread is just keep checking in a timer body the semaphore whether it can read the first buffer.During that the second thread basically continuously reading port and putting values into that first of two buffers of 500 integers so when this first buffer is full semaphore sets one as "ok buffer full". So now the main thread able to read the first buffer into screen. And so on... that sound good to me maeby any other ideas?
    Anyway the main problem is that the timer used by main thread is as it looks sharing the memory with the GUI and all user events to be able make action on user input or other event. So thus I thing it is not smooth process of the timer.And I just need to have quick and smooth timer to display my data from port.
    Guys I hope it is clearly explained I would be really happy if someone can help... Thank you verry much

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Any Multithreading specialist?

    Why not have two threads - a GUI thread and a communications thread. When the communication thread gets enough buffer it sends a signal to the gui thread "Display this data" and then starts filling in a another buffer. It will repeat indefinitely until told to stop.

Similar Threads

  1. regarding multithreading
    By mohanakrishnan in forum Qt Programming
    Replies: 19
    Last Post: 9th December 2009, 09:21
  2. Yet another another multithreading problem!
    By nimaweb in forum Qt Programming
    Replies: 6
    Last Post: 11th August 2009, 15:45
  3. multithreading
    By mickey in forum General Programming
    Replies: 2
    Last Post: 5th June 2008, 23:01
  4. MultiThreading in Qt
    By manivannan_1984 in forum Qt Programming
    Replies: 7
    Last Post: 7th November 2006, 20:26
  5. MultiThreading n Qhttp
    By Shambhavi in forum Qt Programming
    Replies: 1
    Last Post: 18th January 2006, 14:36

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.