From: pito <pi...@vo...> - 2012-06-05 10:09:28
|
Hi, I've read the .pdf document on the amforth's multitasker and, as I am a newbie with it, I am overhelmed by a term "task" and its friends so not easy to follow at least on the first reading. I think that cooperative mutlitasker is basically a multithreader, where we may have many threads, and each thread may contain one or more tasks. So for example: : run1-demo ( my task - interesting stuff in here ... ) ; : run2-demo ... ; $20 $20 0 thread: thread_demo \ create thread, allot tcb + stack space : thread-demo-start thread_demo tcb>tid activate \ words/tasks after this line are run in the new thread run1-demo run2-demo ; and for example: : thread-stop ( -- ) pass status ! pause ; \ sleep current thread : thread-sleep ( tid -- ) pass swap ! ; \ sleep another thread : thread-awake ( tid -- ) wake swap ! ; \ wake another thread etc... What I want to show here is maybe the way how to better structure the stuff - into "threads" and its "tasks".. p. -- - - Reklama - - - - - - - - - - - - - - Maturity, přijímací zkoušky, státnice, diplomky... Vše o závěru studia na středních a vysokých školách čtěte na portálu VOLNÝ.cz na http://bit.ly/LfImCR |