Update of /cvsroot/win32forth/win32forth/demos
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv9791/demos
Modified Files:
taskdemo.f
Log Message:
Modified wait in demo to deal with messages. Deprecated task-sleep (equivalent to ANSI ms)
Index: taskdemo.f
===================================================================
RCS file: /cvsroot/win32forth/win32forth/demos/taskdemo.f,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** taskdemo.f 17 May 2005 22:25:25 -0000 1.3
--- taskdemo.f 22 Aug 2008 21:12:24 -0000 1.4
***************
*** 57,60 ****
--- 57,64 ----
winerrmsg on
+ : WaitForMultipleObjects { ms wait array count -- res } \ Must deal with messages
+ begin QS_ALLINPUT ms wait array count call MsgWaitForMultipleObjects
+ dup WAIT_OBJECT_0 count + = while drop winpause repeat ;
+
0 value taskwaits
: wait-eachtask ( -- ) \ wait for each task
***************
*** 64,68 ****
while
INFINITE false taskhndls \ wait for 1 or more tasks to end
! taskwaits call WaitForMultipleObjects \ wait on handles list
dup WAIT_FAILED = if getlastwinerr then \ note the error
WAIT_OBJECT_0 +
--- 68,72 ----
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 +
***************
*** 90,94 ****
;
! : demo1
cls
." Demo1: Creating free running tasks "
--- 94,98 ----
;
! : demo1
cls
." Demo1: Creating free running tasks "
***************
*** 104,112 ****
: t2-openfile ( addr len -- )
r/o open-file abort" File open error!" fhndl ! ;
!
: my-task2 { speed -- }
console-lock lock
tcb @ task>id @ ." Task" . ." is running with a delay of"
! speed . cr
console-lock unlock
s" src\lib\task.f" Prepend<home>\ t2-openfile
--- 108,116 ----
: t2-openfile ( addr len -- )
r/o open-file abort" File open error!" fhndl ! ;
!
: my-task2 { speed -- }
console-lock lock
tcb @ task>id @ ." Task" . ." is running with a delay of"
! speed . cr
console-lock unlock
s" src\lib\task.f" Prepend<home>\ t2-openfile
***************
*** 122,126 ****
repeat
fhndl @ close-file ;
!
0 value task-slow
0 value task-fast
--- 126,130 ----
repeat
fhndl @ close-file ;
!
0 value task-slow
0 value task-fast
|