@staticmethod
    def SetReadOnly(readonly):
        if (BCache.bcache != None):
            BCache.bcache.close()
        boardf = open(Config.Config.GetBoardsFile(), 'r+b')
        if (boardf == None):
            print "Cannot open boards file"
            return False
        if (readonly):
            BCache.bcache = mmap.mmap(boardf.fileno(), Config.MAXBOARD * BoardHeader.size, flags=mmap.MAP_SHARED, prot=mmap.PROT_READ)
        else:
            BCache.bcache = mmap.mmap(boardf.fileno(), Config.MAXBOARD * BoardHeader.size, flags=mmap.MAP_SHARED, prot=mmap.PROT_READ | mmap.PROT_WRITE)
        boardf.close()
        return True
dataset/ETHPy150Open HenryHu/pybbs/BCache.py/BCache.SetReadOnly/original