diff --git a/plugins/pyloader/src/CPUPolicy.py b/plugins/pyloader/src/CPUPolicy.py index 3204da3..ce37660 100644 --- a/plugins/pyloader/src/CPUPolicy.py +++ b/plugins/pyloader/src/CPUPolicy.py @@ -109,11 +109,11 @@ class CPUPolicy: # @code # # As a lambda anonymous function (preferred) # # (x and y are two DynamicSchedulable objects) - # cmpf = lambda x,y: x.someProperty() < y.someProperty() + # cmpf = lambda x,y: x.someProperty() <= y.someProperty() # # # As a normal *global* function # def compare(a,b): - # return a.someProperty < b.someProperty() + # return a.someProperty <= b.someProperty() # cmpf = compare # @endcode # @@ -124,6 +124,12 @@ class CPUPolicy: # self.sort(queue, cmpf) # @endcode # + # Since queue.sort() uses a in-place version of the + # quicksort algorithm, note the effect of using "<" + # instead than "<=": quicksort wouldn't be stable anymore. + # You have been warned. If your policy behaves strangely, + # this may be the cause. + # # @param self The object caller # @param queue The ReadyQueue to be sorted in place # @param cmpf The binary function to use to compare elements