Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TQueue question

Status
Not open for further replies.

walkesh

Programmer
Mar 31, 2009
9
US
I have a Delphi application that is sending commands serially to a connected device. I am using TQueue to hold the commands that I want to send. There are instances where the user may click a button on the screen and I want to be able to push a new command to the top of the queue so it comes off first. Instead of the typical Queue (First In First Out) behavior. Does anyone have any ideas on what I need to do in order to get this behavior? Does anyone have any code examples?

Thanks!
 
If I was implementing your requirement, I wouldn't modify the TQueue class but I would have a separate TQueue (or possibly TStack) object to deal with high priority commands.

So the code that outputs commands to the connected device would first output any commands in the high priority queue and only if the high priority queue is empty would it output commands from the standard FIFO queue.



Andrew
Hampshire, UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top