Parent: #12, #1. Follow-up from #18.
Goal
Give AsyncIterator helper records (AsyncIterator.prototype.map/filter/take/drop/flatMap and AsyncIterator.from wrappers) the same no-GIL synchronization story as the sync lazy Iterator Helpers.
Current state
The sync helper paths now guard IterHelper.running / done state transitions with IterHelper.lock and avoid holding that lock across user callbacks or iterator next / return calls.
The async helper paths share the same IterHelper struct, but asyncIterHelperNextFn, asyncHelperProduce, and asyncIterHelperReturnFn still read/write helper fields directly:
donestartedcounterinnerrunning(currently unused by the async path)
That means same-helper cross-thread calls can race while one call is awaiting an underlying async iterator or callback.
Acceptance criteria
- Decide/document whether AsyncIterator helpers are shared-realm callable from multiple JS threads or thread-affine.
- If shared, use
IterHelper.lockor an equivalent guard for async helper entry/exit and state publication. - Do not hold the helper lock across awaits, user callbacks, async iterator
next, or async iteratorreturncalls. - Define the concurrent
.next()/.return()behavior while an async helper is already executing; prefer matching the sync helperrunningTypeError behavior if that fits the internal promise model. - Add focused no-GIL coverage for same-helper concurrent async
.next()/.return()behavior. - Update
docs/threads/bindings.mdwith the async helper ruling.