示例#1
0
 def __init__(self, lockfilename):
     BaseThread.__init__(self)
     self._f = lockfilename
     self._create_flag = False
     self._checkfile()
     self._lock_flag = LOCK_EX
     self._locked = False
示例#2
0
 def __init__(self, maxsize=sys.maxint, name="<?wq>",
              priority_support=False, parent=None, log=None):
     BaseThread.__init__(self,name=name,log=log)
     self.__parent  = parent
     self.__ps      = priority_support
     self.__maxsize = maxsize
     self.__tasks   = PriorityQueue(self.__maxsize)
     self.__mutex   = threading.RLock()
示例#3
0
 def __init__(self, interval=1.0, accuracy=0.01,function=None, log=None, args=(), kwargs={}):
     BaseThread.__init__(self,log)
     self.log = LogAdapter(log)
     self._interval = interval
     self._accuracy = accuracy
     self._func = function
     self._args = args
     self._kwargs = kwargs
示例#4
0
 def __init__(self,maxsize=sys.maxint,name="<?wq>",redoable_support=False,
              priority_support=False, parent=None,log=None):
     BaseThread.__init__(self,name=name,log=log)
     self._wq_parent = parent
     self._redoable_support = redoable_support
     self._priority_support = priority_support
     if self._priority_support:
         self.works = PriorityQueue(maxsize)
         self.doneWorks = PriorityQueue(maxsize)
     else:
         self.works = Queue(maxsize)
         self.doneWorks = Queue(maxsize)
     self.maxsize = maxsize
     self._mutex=threading.RLock()
     self.last_working_time=None
     self._db_conn = None
示例#5
0
 def __init__(self,group="",maxsize=20,minsize=10,redoable_supoort=False,
              priority_support=False,log=None,parent=None):
     BaseThread.__init__(self,name="WorkShop",log=log)
     self._parent   = parent
     self._group_id = group
     self._minsize  = minsize
     self._maxsize  = maxsize
     self._redoable_supoort = redoable_supoort
     self._priority_support = priority_support
     self._dispatch_cursor = 0
     self._mutex = threading.RLock()
     self._workers=[]
     if priority_support:
         self._prepared_works = PriorityQueue()
         self._work_buf = PriorityQueue() # buffer when _prepared_works full
     else:
         self._prepared_works = Queue()
         self._work_buf = Queue()
 def __init__(self,log=None):
     BaseThread.__init__(self,name="InitDispatcherThread",log=log)
     self._groups = []
     self._works  = []
     self._dispatcher = Dispatcher()