From: Jos v.d.V. <jo...@us...> - 2008-10-25 15:18:51
|
Update of /cvsroot/win32forth/win32forth/demos In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20108 Modified Files: taskdemo.f Log Message: Jos: Got demo1 working again. Index: taskdemo.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/demos/taskdemo.f,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** taskdemo.f 22 Aug 2008 21:12:24 -0000 1.4 --- taskdemo.f 25 Oct 2008 15:18:46 -0000 1.5 *************** *** 32,36 **** c-unlock loop ! c-lock 50 location @ gotoxy ." Exiting..." c-unlock 1 ; \ my exit code 15 value taskcount \ number of tasks to start --- 32,37 ---- c-unlock loop ! console-lock lock 50 location @ gotoxy ." Exiting..." ! 1 ; \ my exit code and leave the console locked 15 value taskcount \ number of tasks to start *************** *** 67,78 **** taskwaits while ! INFINITE false taskhndls \ wait for 1 or more tasks to end ! taskwaits WaitForMultipleObjects \ wait on handles list dup WAIT_FAILED = if getlastwinerr then \ note the error WAIT_OBJECT_0 + dup>r taskblocks +cells @ task>id @ \ get the task id ! console-lock lock ! ." Task " . ." completed" cr ! console-lock unlock -1 +to taskwaits \ 1 fewer task, clean up the list taskhndls taskwaits cells+ @ \ get last handle in list --- 68,79 ---- taskwaits while ! INFINITE false taskhndls \ wait for 1 or more tasks to end ! taskwaits WaitForMultipleObjects \ wait on handles list dup WAIT_FAILED = if getlastwinerr then \ note the error WAIT_OBJECT_0 + dup>r taskblocks +cells @ task>id @ \ get the task id ! \ console-lock lock \ locking here wil lock the whole system ! ." Task " . ." completed" cr ! console-lock unlock \ Unlock here.( was locked at the task exit ) -1 +to taskwaits \ 1 fewer task, clean up the list taskhndls taskwaits cells+ @ \ get last handle in list *************** *** 86,93 **** : start-tasks ( n -- ) make-tasks ! run-tasks ! console-lock lock 0 25 gotoxy ." Main task is waiting for " taskcount . ." tasks" cr ! console-lock unlock wait-eachtask ." All tasks ended" cr --- 87,94 ---- : start-tasks ( n -- ) make-tasks ! console-lock lock \ Prevents locking by the tasks ! run-tasks \ They will wait till the console is unlocked 0 25 gotoxy ." Main task is waiting for " taskcount . ." tasks" cr ! console-lock unlock \ The tasks will continue to run here wait-eachtask ." All tasks ended" cr |