On Donnerstag 19 Juni 2008, Sergey Plis wrote: > Hi Bernd, > > Can you give an advise on how to write a word that executes using its > own return and data stacks. I need something different than cooperative > multitasking in tasker.fb. I want to pass such function to > pthread_create so it can execute in parallel, while having access to all > data. If that is possible then it seems to be possible to mimic parallel > execution functionality (in a limited form but enough for me) of > Marcel's iForth.
The cooperative multitasker provides most of the necessary function. NEWTASK creates a new user area plus stacks, and ACTIVATE or PASS transfer functions to the task. Now what you don't need is the cooperative multitasker itself, so you have to copy the relevant functions that call WAKE, and replace it with a version that uses a different list (one list per thread). Finally, you need a C-callable function that actually jumps into this task. This should be fairly trivial; the start routine would take the argument ARG and move it to UP, like Code start-routine :R 4 SP D) UP mov ' pause arel) jmp end-code If you don't have success, I'll take a shoot at it, sounds not too complicated. -- Bernd Paysan "If you want it done right, you have to do it yourself" http://www.jwdt.com/~paysan/
signature.asc
Description: This is a digitally signed message part.
