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

Multi threading

P: 11
Hi,

I am writing a program using multiple threads. I gave the time slice as 10 ms. I have created a thread named mythread. Sometimes mythread takes 20 or 30 ms for completting its execution. So mythread go to wait state after 10 ms, if any other process wait for execution. But i need to run mythread with out any breakage of execution. Is there any method to run mythread with out any interruption.

Thanks in advance,
Oct 3 '06 #1
Share this Question
Share on Google+
7 Replies


Banfa
Expert Mod 5K+
P: 8,916
On what OS?
Oct 3 '06 #2

P: 11
It is a RTOS named ETS.
Oct 4 '06 #3

Banfa
Expert Mod 5K+
P: 8,916
Most RTOS have a way of disabling the task sheduler temorarily so that no task switches take place. You can also disable interrupts if necessary.
Oct 4 '06 #4

P: 11
Yes, I got the command for disble the scheduler.
Thanks
Oct 4 '06 #5

P: 11
Is there any WIN32 API commands present for disabling task scheduler?
Oct 5 '06 #6

Banfa
Expert Mod 5K+
P: 8,916
Not that I am aware of but then it is slightly different from an embedded application.

What you can do is with-in your application suspend the threads that you don't wish to run using ThreadSuspend (or is it SuspendThread??)
Oct 5 '06 #7

P: 11
I need to switch on a digital output for some interval(in milliseconds). The interval should be very accurate. I switched on the output and wait for sometime using Sleep() command then switch off the output. Its working fine with error of 200 micro seconds. But now i need sub-milliseconds, So i used some loops for giving delay instead of Sleep() command. The delay is varied time to time. I think this is due to interruption of other process. Now i tried with timer interrupts. But its hard to work with microseconds in timer interrupts.
Oct 5 '06 #8

Post your reply

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