--- In
basicx@yahoogroups.com, "Tom Becker" <gtbecker@r...> wrote:
> Great! Then some convenient functions to control these things
> would be valuable additions to the tools. Can they be written?
Sub AbortTask(taskStack() as Byte)
taskStack(1) = bxExitTask
End Sub
Sub AwakenTask(taskStack() as Byte)
Dim wasLocked as Boolean
wasLocked = TaskIsLocked()
If (Not wasLocked) Then
Call LockTask()
End If
If (taskStack(1) = bxTaskSleeping) Then
taskStack(1) = bxTaskRunning
End If
If (Not wasLocked) Then
Call UnlockTask()
End If
End Sub
Sub SleepTask(taskStack() as Byte, ByVal sleepTime as Integer)
Dim wasLocked as Boolean
wasLocked = TaskIsLocked()
If (Not wasLocked) Then
Call LockTask()
End If
taskStack(1) = bxTaskSleeping
Call BlockMove(2, MemAddress(sleepTime), MemAddress(taskStack(2)))
If (Not wasLocked) Then
Call UnlockTask()
End If
End Sub
The first two are untested but should work as advertised.
The SleepTask() subroutine appears to work but it may not work
reliably due to the issues that I pointed out in my previous message.
Don