??? 05/14/04 08:52 Read: times |
#70326 - RE: INFO: RS485 and Win9X RTS toggle option Responding to: ???'s previous message |
Hi Kiran,
Please know that I am by no means a great Windows expert nor do I have any affiliation with Microsoft. It's just that I think that putting the blame on an easy and popular target like Windows (98!!!!) is not going to bring any solution to anybody. Seeing the reaction from others, Windows Bashing is quite a popular sport, so I decided I didn't have much to add. But if you insist, here i go again :) The method sleep() you mention is not for exact timing purposes, and nor does Microsoft claim so. In fact, if you would bother to look it up on MSDN, you will find that all it does id SUSPEND the current thread for A MINIMUM OF the specified number of milliseconds: http://msdn.microsoft.com/library/d.../sleep.asp There is no mystery there. It is best to RTFM before making assumptions as to whether a product is wrong or if your expectations of the product are wrong. Examples of exactly this we see on this board many times a day, in different forms. So how many ms your thread will be suspended exactly will depend on other threads, their priorities, AND on the granularity of timeslicing, which I don't know how many ms that is ecactly, but I wouldn't be at all surprised if that would be near 50ms (you could actually change the granularity of Windows to improve the performance of sleep(), but you would still be using it for a purpose it is not intended for). If you want accurate timing from a Windows machine, there are third party API's available which can help you, but to my knowledge none are included with Windows by default. |