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?
Published at
2024-03-17 22:07:21Event JSON
{
"id": "e7d4306014c42860cba3c579b72fe711670ec6cb53eb879f7a78b6a2e466b79b",
"pubkey": "5945ca72a468500fbf0009417a8998a8f801b45869ed995977e8d96d33a6933b",
"created_at": 1710713241,
"kind": 1,
"tags": [
[
"proxy",
"https://indieweb.social/users/brentsimmons/statuses/112113302979454982",
"activitypub"
]
],
"content": "Here’s the problem I’m trying to solve: I want to make ArticleStatus — which has two Bool properties (read/starred) — Sendable.\n\nFor good reasons, it can’t be an Actor or a struct.\n\nSeems like protecting each of those two properties with a lock of some kind is probably the way to go.\n\nDo I:\n\n1) Use one (or perhaps two) locks per instance? Or…\n\n2) Use one lock shared by all instances?\n\n(Leaning toward #2.)\n\nRelated: is OSAllocatedUnfairLock the go-to for locks these days?",
"sig": "aad9001bda345fd0c4352a2db7083133e8366941b13bbc8f31ca0662927d2fd8dabd72739cd37d13310cc6474373480dddd7d002041104d85dbf9045c6b1347e"
}