home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 June / maximum-cd-2009-06.iso / DiscContents / digsby_setup.exe / lib / util / threads / bgthread.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-02-26  |  1.6 KB  |  39 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. import util.primitives.funcs as funcs
  5. import threading
  6. __all__ = [
  7.     'BackgroundThread',
  8.     'add_before_cb',
  9.     'add_before_cb']
  10.  
  11. class DelegateThread(threading.Thread):
  12.     
  13.     def __init__(self, group = None, target = None, name = None, args = (), kwargs = None, verbose = None):
  14.         threading.Thread.__init__(self, group, target, name, args, kwargs, verbose)
  15.         self.BeforeRun = funcs.Delegate()
  16.         self.AfterRun = funcs.Delegate()
  17.  
  18.  
  19.  
  20. class BackgroundThread(DelegateThread):
  21.     
  22.     def __init__(self, group = None, target = None, name = None, args = (), kwargs = None, verbose = None):
  23.         DelegateThread.__init__(self, group, target, name, args, kwargs, verbose)
  24.         self.setDaemon(True)
  25.         self.BeforeRun[:] = _before_run
  26.         self.AfterRun[:] = _after_run
  27.  
  28.  
  29. _before_run = []
  30. _after_run = []
  31.  
  32. def add_before_cb(cb):
  33.     _before_run.append(cb)
  34.  
  35.  
  36. def add_after_cb(cb):
  37.     _after_run.append(cb)
  38.  
  39.