What is Nostr?
Brent Simmons /
npub1t9z…0pps
2024-03-17 22:07:21

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?
Author Public Key
npub1t9zu5u4ydpgql0cqp9qh4zvc4ruqrdzcd8kejktharvk6vaxjvasqc0pps