mirror of
https://github.com/dlang/phobos.git
synced 2025-04-26 13:10:35 +03:00
13 lines
620 B
Text
13 lines
620 B
Text
Added the `SharedAllocatorList`, as the thread-safe version of the regular `AllocatorList`.
|
|
|
|
The new $(REF SharedAllocatorList, std,experimental,allocator,building_blocks,allocator_list) has the same semantics as the regular `AllocatorList`.
|
|
Just as the regular `AllocatorList`, if the `BookkeepingAllocator` is `NullAllocator`, the `SharedAllocatorList` will switch to `ouroboros` mode,
|
|
allocationg memory for its own metadata.
|
|
|
|
---
|
|
SharedAllocatorList!((n) => SharedAscendingPageAllocator(max(n, numPages * pageSize)), NullAllocator) a;
|
|
auto b = a.allocate(100);
|
|
assert(b.length == 100);
|
|
|
|
assert(a.deallocate(b));
|
|
---
|