This is an integer (or long integer) which is guaranteed to be unique and constant for this object during its lifetimeМогут ли возникнуть какие-нибудь побочные эффекты у такого решения?
This is an integer (or long integer) which is guaranteed to be unique and constant for this object during its lifetimeМогут ли возникнуть какие-нибудь побочные эффекты у такого решения?
class Scheduler(threading.Thread):
def add(self, fn, calc_time):
key = self.getKey()
with self.lock:
self.items[key] = Task(fn, calc_time)
return key
def update(self, key, calc_time):
with self.lock:
self.items[key].setCalcTime(calc_time)
class Scheduler(threading.Thread):
def add(self, fn, calc_time):
key = self.getKey()
with self.lock:
task = Task(fn, calc_time)
self.items.append(task)
return task
def update(self, task, calc_time):
with self.lock:
task.setCalcTime(calc_time)