Skip to content

feat: add thread-safe weak container#29

Merged
AllDmeat merged 3 commits intomainfrom
feature/dbthreadsafe-weak-container
May 4, 2026
Merged

feat: add thread-safe weak container#29
AllDmeat merged 3 commits intomainfrom
feature/dbthreadsafe-weak-container

Conversation

@AllDmeat
Copy link
Copy Markdown
Contributor

@AllDmeat AllDmeat commented May 4, 2026

Summary

Adds a new DBThreadSafeWeakContainer to DBThreadSafe-ios for thread-safe storage of weak references with an API that matches the library style. This is needed to move the app's local weak container implementation into the shared package.

Key changes

  • Added a public DBThreadSafeWeakContainer<T> that supports weak references to class-bound protocol existential types
  • The container supports the same lock backends as the main package: Synchronization.Mutex on supported OS versions and pthread_rwlock_t as a fallback
  • The weak container exposes only the withLock access API, plus lockType and initializers with lock backend selection
  • Added package tests covering weak reference storage, automatic nil after deallocation, support for protocol existential types, and backend selection
  • Updated the README with documentation for the new container

Additional changes

  • None

AllDmeat and others added 3 commits May 4, 2026 20:27
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@AllDmeat AllDmeat enabled auto-merge (squash) May 4, 2026 15:50
@AllDmeat AllDmeat disabled auto-merge May 4, 2026 15:52
@AllDmeat AllDmeat merged commit 0548278 into main May 4, 2026
5 checks passed
@AllDmeat AllDmeat deleted the feature/dbthreadsafe-weak-container branch May 4, 2026 15:59
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