diff --git a/src/lib/sync/mpmc.ts b/src/lib/sync/mpmc.ts index 62ae536..302d010 100644 --- a/src/lib/sync/mpmc.ts +++ b/src/lib/sync/mpmc.ts @@ -362,7 +362,7 @@ export class Receiver extends ChannelHandle { } } -export function channel(capacity: number = 32): [Sender, Receiver] { +export function channel(capacity: number = 32, options?: { size?: number }): [Sender, Receiver] { const state = new Int32Array( new SharedArrayBuffer(META_SIZE * Int32Array.BYTES_PER_ELEMENT), ); @@ -375,7 +375,7 @@ export function channel(capacity: number = 32): [Sender, Receiver] { state[IDX_RX_COUNT] = 1; const initialData = new Array(capacity).fill(null); - const items = new SharedJsonBuffer(initialData); + const items = new SharedJsonBuffer(initialData, options); const internals = new ChannelInternals( state,