Прерывание и возобновление кода из очереди в цикле ⇐ C++
-
Anonymous
Прерывание и возобновление кода из очереди в цикле
I have queue with objects, which are executed sequentially. There is no operating system, I'm just using the hardware and my code:
while(true) { if( next = queue.next() ) { next->do_stuff() } } Now I want to suspend the code which is executed at next->do_stuff(), based on some hardware interrupts (there are no more details needed about the hardware interrupts). This suspend should save the state (current instruction) and enqueue the next back to the queue, so that the next do_stuff of this next starts at the last instruction, before suspending it. I know, how to safe the state, but I have no idea, how to return from do_stuff. I think, this should be done with assembly.
Some Buzzwords what to search for, would be really nice. Thanks
Источник: https://stackoverflow.com/questions/432 ... -in-a-loop
I have queue with objects, which are executed sequentially. There is no operating system, I'm just using the hardware and my code:
while(true) { if( next = queue.next() ) { next->do_stuff() } } Now I want to suspend the code which is executed at next->do_stuff(), based on some hardware interrupts (there are no more details needed about the hardware interrupts). This suspend should save the state (current instruction) and enqueue the next back to the queue, so that the next do_stuff of this next starts at the last instruction, before suspending it. I know, how to safe the state, but I have no idea, how to return from do_stuff. I think, this should be done with assembly.
Some Buzzwords what to search for, would be really nice. Thanks
Источник: https://stackoverflow.com/questions/432 ... -in-a-loop
Мобильная версия