def run(self, timeoutms): assert not _pyndn.is_run_executing(self.ndn_data), "Command should be called when ndn_run is not running" self._handle_lock.acquire() try: _pyndn.run(self.ndn_data, timeoutms) finally: self._handle_lock.release()
def run(self, timeoutms): assert not _pyndn.is_run_executing( self.ndn_data ), "Command should be called when ndn_run is not running" self._handle_lock.acquire() try: _pyndn.run(self.ndn_data, timeoutms) finally: self._handle_lock.release()
def output_is_pending(self): assert not _pyndn.is_run_executing( self.ndn_data ), "Command should be called when ndn_run is not running" return _pyndn.output_is_pending(self.ndn_data)
def process_scheduled(self): assert not _pyndn.is_run_executing( self.ndn_data ), "Command should be called when ndn_run is not running" return _pyndn.process_scheduled_operations(self.ndn_data)
def _release_lock(self, tag): if not _pyndn.is_run_executing(self.ndn_data): # print("%s: releasing lock" % tag) self._handle_lock.release()
def _acquire_lock(self, tag): if not _pyndn.is_run_executing(self.ndn_data): # print("%s: acquiring lock" % tag) self._handle_lock.acquire()
def output_is_pending(self): assert not _pyndn.is_run_executing(self.ndn_data), "Command should be called when ndn_run is not running" return _pyndn.output_is_pending(self.ndn_data)
def process_scheduled(self): assert not _pyndn.is_run_executing(self.ndn_data), "Command should be called when ndn_run is not running" return _pyndn.process_scheduled_operations(self.ndn_data)
def stop(self): self.running = False for fd, handle in zip(self.fds.keys(), self.fds.values()): # disconnect only when nothing is running, otherwise segfaul guaranteed if not _pyndn.is_run_executing(handle.ndn_data): handle.disconnect()
def stop(self): self.running = False for fd, handle in zip(self.fds.keys(), self.fds.values()): # disconnect only when nothing is running, otherwise segfaul guaranteed if not _pyndn.is_run_executing (handle.ndn_data): handle.disconnect ()