Re: two possible bugs in tasking
- Posted by useless_ Sep 19, 2012
- 1447 views
What is going on in the task manager with these? What i expect to happen in both taskbug.ex's is the program exits the while loop at line 276 and then runs like an non-tasked code body.
The problem is that you are only suspending the tasks. I don't believe that there is a way to kill a task. Try adding this function (or something like it):
function task_list() sequence all_tasks = eu:task_list() sequence active_tasks = {} for i = 1 to length( all_tasks ) do if task_status( all_tasks[i] ) = 1 then active_tasks &= all_tasks[i] end if end for return active_tasks end function
What you're really interested in is if there are any active tasks. Just suspending a task does not remove it from the list of tasks as reported by task_list(). Perhaps we could add an optional parameter to filter the task list.
Matt
That answers the other unanswered question too: can the task manager run out of task ID numbers? If a task stops running via task_suspend, it's ID can't be reused.
useless