fix RingBuffer naming 'final'
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export type Pooled<T> = {
|
||||
export type RingBuffer<T> = {
|
||||
size: number;
|
||||
mask: number;
|
||||
cursor: number;
|
||||
@@ -8,7 +8,7 @@ export type Pooled<T> = {
|
||||
export function createRingBuffer<T extends object>(
|
||||
size: number,
|
||||
create: () => T,
|
||||
): Pooled<T> {
|
||||
): RingBuffer<T> {
|
||||
if ((size & (size - 1)) !== 0) {
|
||||
throw new Error("size must be a power of two");
|
||||
}
|
||||
@@ -26,7 +26,7 @@ export function createRingBuffer<T extends object>(
|
||||
};
|
||||
}
|
||||
|
||||
export function claim<T>(ring: Pooled<T>): T {
|
||||
export function claim<T>(ring: RingBuffer<T>): T {
|
||||
const slot = ring.buffer[ring.cursor];
|
||||
ring.cursor = (ring.cursor + 1) & ring.mask;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user