Пример #1
0
 def Write( self, action, priority, synchronous, *args, **kwargs ):
     
     job_type = 'write'
     
     job = HydrusData.JobDatabase( job_type, synchronous, action, *args, **kwargs )
     
     if self._controller.ModelIsShutdown():
         
         raise HydrusExceptions.ShutdownException( 'Application has shut down!' )
         
     
     self._jobs.put( ( priority, job ) )
     
     if synchronous: return job.GetResult()
Пример #2
0
 def Read( self, action, priority, *args, **kwargs ):
     
     if action in self.READ_WRITE_ACTIONS: job_type = 'read_write'
     else: job_type = 'read'
     
     synchronous = True
     
     job = HydrusData.JobDatabase( job_type, synchronous, action, *args, **kwargs )
     
     if self._controller.ModelIsShutdown():
         
         raise HydrusExceptions.ShutdownException( 'Application has shut down!' )
         
     
     self._jobs.put( ( priority + 1, job ) ) # +1 so all writes of equal priority can clear out first
     
     return job.GetResult()