By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,302 Members | 1,499 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,302 IT Pros & Developers. It's quick & easy.

suspend and resume

P: 2
I am working on a program that has one function running, then interrupted by another function. After the interrupting function finishes, the original function should resume from the point where it gets interrupted.
How should i deal with this case?
I really appreciate it if someone can give me some suggestions to help a newbie out?
Sep 30 '06 #1
Share this Question
Share on Google+
3 Replies

P: 293
In assembly, there is a convenient instruction, usually named RETI, that is "return from interrupt".

How do you plan on generating the interrupt? I assume it's timer- or thread-generated interrupt. Otherwise, I don't see how it wouldn't happen at the same point in your code every time. In that case, you could call a subroutine. If you have the technology to generate interrupts, you should have the technology to return from interrupts.
Sep 30 '06 #2

P: 2
I want to use thread-generated interrupt.please tell me what should i do?Thank you!
Oct 8 '06 #3

Expert Mod 5K+
P: 8,916
You don't need to do anything, just start your 2 threads, the OS should handle swopping between them for you.

If there are sections of code that need to run exclusively (i.e. while 1 thread is running them the other thread can not be allowed to also run them) then use semaphore (or mutex or critical section on windows) prtection to prevent more than 1 thread at a time running the code.
Oct 9 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.