Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

threadSafeAllocator

Provides a lock free thread safe Allocator interface to the underlying FixedBufferAllocator

Using this at the same time as the interface returned by allocator is not thread safe.

FixedBufferAllocator.threadSafeAllocator
pub fn threadSafeAllocator(self: *FixedBufferAllocator) Allocator

File

lib/std/heap/FixedBufferAllocator.zig:34

Code

pub fn threadSafeAllocator(self: *FixedBufferAllocator) Allocator {
    return .{
        .ptr = self,
        .vtable = &.{
            .alloc = threadSafeAlloc,
            .resize = threadSafeResize,
            .remap = threadSafeRemap,
            .free = threadSafeFree,
        },
    };
}