OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self, path_or_fd, ofs, size, flags=0) |
def | __repr__ (self) |
def | buffer (self) |
def | map (self) |
def | ofs_begin (self) |
def | size (self) |
def | ofs_end (self) |
def | includes_ofs (self, ofs) |
def | client_count (self) |
def | increment_client_count (self, ofs=1) |
def | release (self) |
Defines a mapped region of memory, aligned to pagesizes **Note:** deallocates used region automatically on destruction
def __init__ | ( | self, | |
path_or_fd, | |||
ofs, | |||
size, | |||
flags = 0 |
|||
) |
Initialize a region, allocate the memory map :param path_or_fd: path to the file to map, or the opened file descriptor :param ofs: **aligned** offset into the file to be mapped :param size: if size is larger then the file on disk, the whole file will be allocated the the size automatically adjusted :param flags: additional flags to be given when opening the file. :raise Exception: if no memory can be allocated
def __repr__ | ( | self | ) |
def buffer | ( | self | ) |
:return: a buffer containing the memory
def client_count | ( | self | ) |
:return: number of clients currently using this region
def includes_ofs | ( | self, | |
ofs | |||
) |
:return: True if the given offset can be read in our mapped region
def increment_client_count | ( | self, | |
ofs = 1 |
|||
) |
Adjust the usage count by the given positive or negative offset. If usage count equals 0, we will auto-release our resources :return: True if we released resources, False otherwise. In the latter case, we can still be used
def map | ( | self | ) |
:return: a memory map containing the memory
def ofs_begin | ( | self | ) |
:return: absolute byte offset to the first byte of the mapping
def ofs_end | ( | self | ) |
:return: Absolute offset to one byte beyond the mapping into the file
def release | ( | self | ) |
Release all resources this instance might hold. Must only be called if there usage_count() is zero
def size | ( | self | ) |
:return: total size of the mapped region in bytes