def createDomain(host, port, entity_root): d = HpiDomain(SAHPI_UNSPECIFIED_DOMAIN_ID, host, port, entity_root) HpiCore.lock.acquire() did = 0 while HpiCore.domains.has_key(did): did = did + 1 d.setLocalDid(did) HpiCore.domains[did] = d HpiCore.lock.release() return d
def createDomain( host, port, entity_root ): d = HpiDomain( SAHPI_UNSPECIFIED_DOMAIN_ID, host, port, entity_root ) HpiCore.lock.acquire() did = 0 while HpiCore.domains.has_key( did ): did = did + 1 d.setLocalDid( did ) HpiCore.domains[did] = d HpiCore.lock.release() return d
def createDefaultDomain(): if HpiCore.domains.has_key( SAHPI_UNSPECIFIED_DOMAIN_ID ): return host = os.environ.get( "OPENHPI_DAEMON_HOST", "localhost" ) portstr = os.environ.get( "OPENHPI_DAEMON_PORT", str( DEFAULT_PORT ) ) try: port = int( portstr ) except ValueError: port = DEFAULT_PORT root = HpiUtil.makeRootSaHpiEntityPathT() d = HpiDomain( SAHPI_UNSPECIFIED_DOMAIN_ID, host, port, root ) HpiCore.domains[d.getLocalDid()] = d
def createDefaultDomain(): if HpiCore.domains.has_key(SAHPI_UNSPECIFIED_DOMAIN_ID): return host = os.environ.get("OPENHPI_DAEMON_HOST", "localhost") portstr = os.environ.get("OPENHPI_DAEMON_PORT", str(DEFAULT_PORT)) try: port = int(portstr) except ValueError: port = DEFAULT_PORT root = HpiUtil.makeRootSaHpiEntityPathT() d = HpiDomain(SAHPI_UNSPECIFIED_DOMAIN_ID, host, port, root) HpiCore.domains[d.getLocalDid()] = d
def createDomainById(did, host, port, entity_root, overwrite): d = None HpiCore.lock.acquire() if (not HpiCore.domains.has_key(did)) or overwrite: d = HpiDomain(did, host, port, entity_root) HpiCore.domains[did] = d HpiCore.lock.release() return d
def __init__(self, domain): HpiSession.next_local_sid_lock.acquire() self.local_sid = HpiSession.next_local_sid HpiSession.next_local_sid += 1 HpiSession.next_local_sid_lock.release() self.remote_sid = None self.domain = HpiDomain.clone(domain) self.marshals = collections.deque() self.marshals_lock = threading.RLock()
def __init__( self, domain ): HpiSession.next_local_sid_lock.acquire() self.local_sid = HpiSession.next_local_sid HpiSession.next_local_sid += 1 HpiSession.next_local_sid_lock.release() self.remote_sid = None self.domain = HpiDomain.clone( domain ) self.marshals = collections.deque() self.marshals_lock = threading.RLock()