Brent Simmons on Nostr: Here’s the problem I’m trying to solve: I want to make ArticleStatus — which ...
Here’s the problem I’m trying to solve: I want to make ArticleStatus — which has two Bool properties (read/starred) — Sendable.
For good reasons, it can’t be an Actor or a struct.
Seems like protecting each of those two properties with a lock of some kind is probably the way to go.
Do I:
1) Use one (or perhaps two) locks per instance? Or…
2) Use one lock shared by all instances?
(Leaning toward #2.)
Related: is OSAllocatedUnfairLock the go-to for locks these days?
For good reasons, it can’t be an Actor or a struct.
Seems like protecting each of those two properties with a lock of some kind is probably the way to go.
Do I:
1) Use one (or perhaps two) locks per instance? Or…
2) Use one lock shared by all instances?
(Leaning toward #2.)
Related: is OSAllocatedUnfairLock the go-to for locks these days?