else: print "%s: readback '%s' disagrees with the value '%s' we wrote." % (function, readback, value) raise ca_utilException, EXCEPTION_READBACK_DISAGREES entry.callbackReceived = 1 except CaChannel.CaChannelException, status: print "%s: exception during readback." % (function) count += 1 if success and (function == "caputw"): start_time = time.time() timed_out = 0 while (not entry.callbackReceived) and (not timed_out): #print "waiting for ", name time.sleep(0.1) #ca.pend_io(0.1) ca.poll() if (not wait_timeout): timed_out = 0 else: timed_out = ((time.time()-start_time) > wait_timeout) if not entry.callbackReceived: print "Execution not completed by wait_timeout (%d seconds)" % wait_timeout ####################################################################### def camonitor(name, function, user_args=None, timeout=None, retries=None): """ usage: camonitor("xxx:m1.VAL", python_function, user_args, timeout=None, retries=None) Don't forget to call ca.pend_event(<pend_time_in_seconds>) periodically. """
def ca_bg_task(): try: ca.poll() except Exception, e: pass
def poll(self): """Flush the send buffer and execute outstanding background activity.""" status = ca.poll() # status is always ECA_TIMEOUT return status