Re: Task scheduler sluggish
- Posted by penpal0andrew Jun 27, 2009
- 1145 views
The problem is that it is very sluggish to run the task. But if I move the mouse around inside the window, the task works at its proper speed.
So, how do I get a task to run every 200 ms, whether or not someone is doing something else at the same time. And yes, I still want other stuff to go on if the user chooses.
Andy K.
My experience with Euphoria tasks is limited so I won't suggest how best to use them. But I do see why you are having this problem. A typical Windows application spends most of it's time waiting for messages. While a thread is waiting for a message it can do nothing else. A Euphoria process has but one thread. Yes, Euphoria has tasks but they are implemented within the interpreter and the system knows nothing of them.
While the single euphoria thread is waiting for a message it can do nothing else, and that means that Euphoria's task sheduler isn't even running. There is no way it can call your thread. When you move the mouse or press a key it becomes active again and the scheduler is able to run again.
I don't think that Euphoria threads are a good fit here. If or when Euphoria has real threads this will be possible. Until then you will need to find another way. One way would be to use a timer that sends a message every 200ms.
[/quote]
Yes. I am now using the setTimer, onTimer event and it is working.