Athena
04-04-2001, 05:27 PM
I've been banging my head on this for a couple hours now, and I'm just not getting it, so I thought I'd toss it out to the Doper crowd.
I basically need to schedule a bunch of events to happen. I maintain a queue, and things can be added at any point in the queue. For example, the queue might contain:
<something that needs to happen in 3 seconds>
<something that needs to happen in 7 seconds>
<something that needs to happen in 12 seconds>
At any point, things can be added any place in the queue.
I need to create a timer that processes these events. I could just set a new timer everyime something is added to the queue, but I could potentially have many, many timers going at once. I have a vague memory of an alogrithm that did this using only one timer, but I used last about 8 years ago, and I'm really fuzzy. Something tells me that it's very similar to the way Unix schedules events, but once again, I don't recall exactly. It had something to do with when you add something to the queue, you add it relative to the current timer that's going. Does this ring any bells?
I basically need to schedule a bunch of events to happen. I maintain a queue, and things can be added at any point in the queue. For example, the queue might contain:
<something that needs to happen in 3 seconds>
<something that needs to happen in 7 seconds>
<something that needs to happen in 12 seconds>
At any point, things can be added any place in the queue.
I need to create a timer that processes these events. I could just set a new timer everyime something is added to the queue, but I could potentially have many, many timers going at once. I have a vague memory of an alogrithm that did this using only one timer, but I used last about 8 years ago, and I'm really fuzzy. Something tells me that it's very similar to the way Unix schedules events, but once again, I don't recall exactly. It had something to do with when you add something to the queue, you add it relative to the current timer that's going. Does this ring any bells?