• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can I get a higher priority than the event dispathcing thread?

 
Matthew Smith
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a thread which is periodically pulling data from a serial port and doing some maths on it. I then need to update a gui component (which is a graphing component I have written). However, I don't want to draw the gui at the expense of the performance of the serial port thread (as this is time critical). Currently the graphing takes too long although I have done everything I can think of to speed it up.
Any ideas?
Cheers
Matthew
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Matthew,
Well, you could do something like:

inside a method that you know is run on the event dispathcer, but that's probably not the best way to accomplish what you want.
A better solution would be to have the thread wait while you were reading the serial port, maybe something similiar to this:

Now somewhere, probably in the serialReader code, you'll need to call serialReader.notifyAll(); when you're ready to resume graphing. The event that triggers the notifyAll() would probably be a buffer filling up. You will have to experiment on the buffer size, but should eventually come up with a good balance.
Hope this helps,
Michael Morris
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!