ngamsHighLevelLib.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:ngas 作者: ICRAR 项目源码 文件源码
def acquireDiskResource(ngamsCfgObj,
                        slotId):
    """
    Acquire access right to a disk resource.

    ngamsCfgObj:   NG/AMS Configuration Object (ngamsConfig).

    slotId:        Slot ID referring to the disk resource (string).

    Returns:       Void.
    """
    T = TRACE()

    storageSet = ngamsCfgObj.getStorageSetFromSlotId(slotId)
    if (not storageSet.getMutex()): return

    global _diskMutexSems
    if (not _diskMutexSems.has_key(slotId)):
        _diskMutexSems[slotId] = threading.Semaphore(1)
    code = string.split(str(abs(random.gauss(10000000,10000000))), ".")[0]
    logger.debug("Requesting access to disk resource with Slot ID: %s (Code: %s)",
                 slotId, str(code))
    _diskMutexSems[slotId].acquire()
    logger.debug("Access granted")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号