Skip to content

Add async observable scaffolding - #25

Closed
rchatham wants to merge 2 commits into
feature/network-migration-threadsafe-eventsfrom
feature/network-migration-async-observers
Closed

Add async observable scaffolding#25
rchatham wants to merge 2 commits into
feature/network-migration-threadsafe-eventsfrom
feature/network-migration-async-observers

Conversation

@rchatham

Copy link
Copy Markdown
Owner

Summary

Begins Swift concurrency modernization for the observer pipeline by adding actor-backed async observable scaffolding while keeping the live synchronous event pipeline unchanged.

Changes

  • Add internal AsyncObservable<T> actor for async value/observer storage and delivery.
  • Add internal AsyncMultiObservable<T> actor for keyed async observer storage and delivery.
  • Add SyncObservableBridge helpers that run async observable operations and block the current synchronous delegate/GCD thread until completion.
  • Document sync-over-async caveats: use only from synchronous entry points; prefer await; do not call from actor-isolated/cooperative executor contexts.
  • Add async and sync-bridge tests covering:
    • current-value replay when observers are added
    • registration-order delivery for AsyncObservable
    • concurrent async updates
    • async keyed observer removal
    • synchronous bridge waiting for delivery completion

Verification

  • swift test --filter AsyncObservableTests
  • swift test
  • xcodebuild test -project PeerConnectivity.xcodeproj -scheme PeerConnectivity -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.3.1' -configuration Debug

Notes

  • This is intended as a stacked follow-up on PR Serialize event observer mutations #24 (feature/network-migration-threadsafe-events).
  • Existing Observable, MultiObservable, and PeerConnectionResponder runtime behavior is not rewired in this PR.
  • The synchronous bridge is intentionally internal scaffolding for future migration steps that need to preserve synchronous callback semantics while moving storage to actors.

…safe-events' into HEAD

# Conflicts:
#	PeerConnectivity.xcodeproj/project.pbxproj
@rchatham

Copy link
Copy Markdown
Owner Author

Superseded by consolidated PR #29. No commits were discarded; this branch is preserved as a recovery and reference point. Addressed review findings were replied to and resolved before consolidation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant