Project

General

Profile

« Previous | Next » 

Revision 1863

parallel.py: Fixed bugs: Added self param to instance methods and inner classes where needed

View differences:

parallel.py
18 18
        
19 19
        def successful(): return True # TODO: False if raised exception
20 20
    
21
    def apply_async(func, args=None, kw_args=None, callback=None):
21
    def apply_async(self, func, args=None, kw_args=None, callback=None):
22 22
        if args == None: args = ()
23
        if kwds == None: kwds = {}
23
        if kw_args == None: kw_args = {}
24 24
        if callback == None: callback = lambda v: None
25 25
        
26 26
        value = func(*args, **kw_args)
27 27
        callback(value)
28
        return Result(value)
28
        return self.Result(value)
29 29

  
30 30
class MultiProducerPool:
31 31
    '''A multi-producer pool. You must call pool.main_loop() in the thread that
......
70 70
        
71 71
        def successful(): raise NotImplementedError()
72 72
    
73
    def apply_async(*args, **kw_args):
73
    def apply_async(self, *args, **kw_args):
74 74
        def call(): self.pool.apply_async(*args, **kw_args)
75 75
        self.queue.put_nowait(call)
76
        return Result()
76
        return self.Result()

Also available in: Unified diff