def unlock(self):
     if self.apt_lock_fd >= 0:
         os.close(self.apt_lock_fd)
         self.apt_lock_fd = None
     if self.lock_fd is not None:
         release_lock(self.lock_fd)
         self.lock_fd = None
         return True
     return False
Exemplo n.º 2
0
	def save(self):
		# remove all sections
		for sec in self.sections():
			self.remove_section(sec)

		for lesson in self.lessons:
			self.add_section(lesson.name)
			self.set(lesson.name, 'begin', str(lesson.begin))
			self.set(lesson.name, 'end', str(lesson.end))

		lock = locking.get_lock('ucs-school-lib-schoollessons')
		with open(LESSONS_FILE, 'w') as fd:
			shutil.copyfile(LESSONS_FILE, LESSONS_BACKUP)
			self.write(fd)
		locking.release_lock(lock)
    def unlock(self):
        # type: () -> bool
        """
		Release locks.

		:returns: `True` if the manager lock was taken, `False` otherwise.
		:rtype: bool
		"""
        if self.apt_lock_fd >= 0:
            os.close(self.apt_lock_fd)
            self.apt_lock_fd = None
        if self.lock_fd is not None:
            release_lock(self.lock_fd)
            self.lock_fd = None
            return True
        return False
Exemplo n.º 4
0
 def unlock(self):
     release_lock(self.lock_fd)
     self.lock_fd = None
Exemplo n.º 5
0
	def unlock(self):
		release_lock(self.lock_fd)
		self.lock_fd = None