Concurrency and host architecture refactoring - #871
Conversation
Key highlights: - Singleton Hosts (`#default` instead of `#new`): Standalone hosts (`BlHeadlessHost`, `BlOSWindowSDL2Host`, `BlOSSDL3Host`, `BlMorphicWindowHost`) are now singletons accessed via `#default`. Sending `#new` now raises an explicit error (`'Use #default instead'`). This directly affects existing scripts that previously instantiated hosts with `#new` (e.g. `aSpace host: BlHeadlessHost default`). - Instance-Side BlHost API & `BlHostRegistry default`: Replaced static class-side host APIs with instance-side host objects managing their own universe, pulse loop, and spaces. - Converts Morphic hosts to run in a separate pulse loop process (like SDL2 and SDL3) and adds double-buffering. - Introduce `BlEventSimulator` based on class-side methods of `BlSpace`. - Removal of `BlMockedHost` (replaced by `BlHeadlessHost default`): Removed `BlMockedHost` and package `BlocHost-Mock`. Rather than expecting manual, explicit `#pulse` calls from tests, headless testing now runs on a pulse process using `BlHeadlessHost default`, matching how normal hosts operate. Any external script, test, or baseline referencing `BlMockedHost` should be updated to `BlHeadlessHost default`. - Event-driven pulse synchronization in `BlParallelUniverse`. - Adds synchronization methods in `BlSpace` (`#deferAndSettle:`, `#defer:`, `#deferOrValue:`, `#settle`, `#isSettled`). - Moves `eventQueue` from `BlHostSpace` to `BlSpace`, and clears pending events when a window closes. - Uses `BlHost` as a facade to encapsulate `universe` (`#spaces`, `#closeSpaces`). - Adds `#denyPulseProcess` to guard against blocking calls from inside the pulse process.
|
Extended: SummaryThis PR proposes changes to improve concurrency and process synchronization between external processes (such as the Morphic UI process from the Playground, test runner processes in SUnit/Calypso, or background worker threads) and the Bloc host pulse loop. Key highlights:
Key Changes
Related Issues
|
|
Mac:Cairo: 1.18.4 Windows:Cairo: 1.17.4 |
Workaround to #872

Key highlights:
#defaultinstead of#new): Standalone hosts (BlHeadlessHost,BlOSWindowSDL2Host,BlOSSDL3Host,BlMorphicWindowHost) are now singletons accessed via#default. Sending#newnow raises an explicit error ('Use #default instead'). This directly affects existing scripts that previously instantiated hosts with#new(e.g.aSpace host: BlHeadlessHost default).BlHostRegistry default: Replaced static class-side host APIs with instance-side host objects managing their own universe, pulse loop, and spaces.BlEventSimulatorbased on class-side methods ofBlSpace.BlMockedHost(replaced byBlHeadlessHost default): RemovedBlMockedHostand packageBlocHost-Mock. Rather than expecting manual, explicit#pulsecalls from tests, headless testing now runs on a pulse process usingBlHeadlessHost default, matching how normal hosts operate. Any external script, test, or baseline referencingBlMockedHostshould be updated toBlHeadlessHost default.BlParallelUniverse.BlSpace(#deferAndSettle:,#defer:,#deferOrValue:,#settle,#isSettled).eventQueuefromBlHostSpacetoBlSpace, and clears pending events when a window closes.BlHostas a facade to encapsulateuniverse(#spaces,#closeSpaces).#denyPulseProcessto guard against blocking calls from inside the pulse process.