def exit_no_event_section(self): """ Re-enables all event emission for this object. :see-also: `enter_no_event_section` """ self.__disabling_count -= 1 exit_cs(self)
def __setattr__(self, name, value): """ Make instance heavier when a new custom attribute is created. """ enter_cs(self) if name not in self.__dict__ and not hasattr(self.__class__, name): self._increase_weight() exit_cs(self) super(PackageElement, self).__setattr__(name, value)
def func(use_cs): for i in xrange(10): if use_cs: enter_cs(d) try: i = shared[0] sleep(.001) shared[0] = i+1 finally: if use_cs: exit_cs(d)