How to start writing a queueing class

A

Angus Comber

Hello

I am writing a real time program which queues up a number of tasks for
processing. Each item in the queue must be submitted to a device
sequentially. ie it is not possible to just blast the hardware with 3
items. Instead you submit job1, wait for notification that job1 is complete
then submit job2, etc. I suppose it is a bit like a print job queueing
system.

How would I start writing a class to control this?

Angus Comber
(e-mail address removed)
 
V

velthuijsen

You could use a std::queue to store the commands.
Then use some wait routine to wait on the interrupt of whatever I/O you
are using to communicate with the device. Then move the first message
in the queue to the machine.
Or write a callback tied to the interrupt.
Have the I/O section in a seperate thread from the part that adds
commands to the queue.
Cannot give more specific ideas since I/O (also
threading/interrupts/wait functions) is platform and in some cases
processor specific.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,293
Messages
2,571,505
Members
48,193
Latest member
DannyRober

Latest Threads

Top