1. "Threads" for Method Euphoria
- Posted by Michael Nelson <mikestar13 at sbcglobal.net> Aug 17, 2005
- 473 views
I have written a cooperative multitasking manager for Method Euphoria and it will be in the upcoming 2.0 release (along with much else.) It is based on Langwar with addtional features. Task are assigned priorites on a 0 (lowest) to 10 scale, activation times, and repeat intervals. I maintain two priortiy queues, an active queue of task that are ready to run, and a waiting queue of tasks whose activation time has not yet been reached. The active queue is sorted by priority number, the waitng queue by activation time. Each call of next_task polls the waiting queue for tasks which are now ready to run and adds them to the active queue, then it pops the first task from the active queue and runs it. After completion, if the task has a repeat interval, a new activation time is calculated and the task is added back to the waiting queue. I am going to adapt this to a non-OOP lib and contribute it. -- Mike Nelson
2. Re: "Threads" for Method Euphoria
- Posted by Al Getz <Xaxo at aol.com> Aug 17, 2005
- 449 views
Michael Nelson wrote: > > I have written a cooperative multitasking manager for Method Euphoria > and it will be in the upcoming 2.0 release (along with much else.) It is > based on Langwar with addtional features. > > Task are assigned priorites on a 0 (lowest) to 10 scale, activation > times, and repeat intervals. I maintain two priortiy queues, an active > queue of task that are ready to run, and a waiting queue of tasks whose > activation time has not yet been reached. The active queue is sorted by > priority number, the waitng queue by activation time. > > Each call of next_task polls the waiting queue for tasks which are now > ready to run and adds them to the active queue, then it pops the first > task from the active queue and runs it. After completion, if the task > has a repeat interval, a new activation time is calculated and the task > is added back to the waiting queue. > > I am going to adapt this to a non-OOP lib and contribute it. > > -- Mike Nelson > > Hi Mike, Sounds interesting, if you make a general purpose version for use with Windows libs i'd be happy to try it out. I've just added some new functions to my ThreadManager02 too, and two queues similar to what it sounds like you did to yours. This of course gives a thread the ability to wait for another thread to complete before it continues (very handy for disk saves) yet doesnt hang the gui. Take care, Al And, good luck with your Euphoria programming! My bumper sticker: "I brake for LED's"