« Previous | Next » 

Revision 125b74b2

ID125b74b274849e717637438c672bbb17a43b5c58
Parent 39f0eea5
Child 9a2564e7

Added by Michael Hanselmann over 10 years ago

workerpool: Change data structure for priority change

To prepare for the addition of a new function allowing changing a
pending task's priority, the internal data structure is slightly
changed. The (optional) task ID is stored as part of the task entry. A
new dictionary provides a mapping from the task ID to its task entry. If
the task ID is None, the entry is not added to the map.

Task entries used to be a tuple, but since modifying the priority
requires changing an entry, they are changed to lists in this patch.
Tuple items can not be modified.

The underlying idea is from [1].

[1]:
http://docs.python.org/library/heapq.html#priority-queue-implementation-notes

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Bernardo Dal Seno <>

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences