I need for an accurate task of about 100ms (for a serial ask) . I use a timer tick event but after some seconds - about 100 sec- the rate increases till to 150-160ms. I try also with a different thread but the problem remains the same.Have someone an idea to resolve the problem?Thanks in advance
Because Windows uses a pre-emptive scheduler there is no software solution available to produce exact timing you're looking for. This is because when the event occurs the thread waiting for the event may not have access to the CPU and may be waiting for the OS to schedule the thread for processor time. So the event will be seen sometime after the event occurs. Maybe right after the event occurs and maybe hundreds of milli-seconds later.