[parrot/parrot] e32f39: Fix race condition in wait for the only extremely ...

GitHub noreply at github.com
Fri Mar 30 18:06:42 UTC 2012


  Branch: refs/heads/threads
  Home:   https://github.com/parrot/parrot
  Commit: e32f39efcb8b615f4d326683063191e8eaf13d7f
      https://github.com/parrot/parrot/commit/e32f39efcb8b615f4d326683063191e8eaf13d7f
  Author: Stefan Seifert <nine at detonation.org>
  Date:   2012-03-30 (Fri, 30 Mar 2012)

  Changed paths:
    M src/scheduler.c
  M t/pmc/task.t

  Log Message:
  -----------
  Fix race condition in wait for the only extremely short task

With only one task on the main thread and one extra task, if the main
task waits immediately for the extra task, it gets suspended. If the
extra task is extremely short, it can be already finished when the main
scheduler checks the foreign tasks and removes the killed ones. Between
the main thread realizing that it has no tasks anymore and that all
foreign tasks are completed the waiting main task could be scheduled but
the scheduler would not check for this anymore and exit the program.

Fixed by rechecking for scheduled tasks after filtering killed foreign
tasks. Also needed is a lock when checking the killed flag of a task so
that either a task is still running or it is killed and the waiting task
scheduled but not killed and still having to schedule.





More information about the parrot-commits mailing list