Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoFreeNumber = errors.New("could not allocate a free number")
Functions ¶
func DestroyShared ¶
DestroyShared cleans up a shared memory region
Types ¶
type Allocator ¶
type Allocator interface { // max number that can be allocated Max() uint64 Allocate() (uint64, error) Free(uint64) error }
func ConcurrentBitmap ¶
ConcurrentBitmap is a lock-free allocator that stores allocations (free/used numbers) as a bitmap. Each number is a position in the bitmap: 0 means free, 1 means allocated.
mem.Size() is in bytes and each bit is a number, thus max will be min(mem.Size() * 8, max), or mem.Size() * 8 when 0 is provided.
type SharedMemory ¶
func LoadShared ¶
func LoadShared(name string, size uint32) (SharedMemory, error)
LoadShared maps a shared memory region. Size must be consistent with all others mapping the same region (i.e.: the same name).
Loading a shared memory region using the wrong size can lead to segmentation faults (SIGSEGV), or truncated data.
Click to show internal directories.
Click to hide internal directories.