Skip to content

mw/com: Various field fixes#735

Open
bemerybmw wants to merge 5 commits into
mainfrom
brem_field_setter_return_result
Open

mw/com: Various field fixes#735
bemerybmw wants to merge 5 commits into
mainfrom
brem_field_setter_return_result

Conversation

@bemerybmw

Copy link
Copy Markdown
Contributor

No description provided.

@bemerybmw
bemerybmw force-pushed the brem_field_setter_return_result branch from 70b9f5b to 7bce8fa Compare July 21, 2026 11:27
@bemerybmw bemerybmw changed the title mw/com: Serialize concurrent field setter calls and propagate error mw/com: Various field fixes Jul 21, 2026
@bemerybmw
bemerybmw marked this pull request as ready for review July 21, 2026 12:17
Comment thread score/mw/com/doc/tutorial/chapter_9/consumer/consumer.cpp Outdated
@bemerybmw
bemerybmw marked this pull request as draft July 21, 2026 13:16
@bemerybmw
bemerybmw force-pushed the brem_field_setter_return_result branch from 7bce8fa to be1c52d Compare July 22, 2026 14:01
Since a set handler will call Send on the owned event, it will require
allocating an event slot. We don't want to support multiple concurrent
calls to setters since we don't see a reasonable use case for this and
it would consume additional resources by requiring us to increase the
size of the slot vector. Therefore, we add a mutex to ensure that only
one set handler can be called at any one time. Another commit will
handle increasing the slot vector size when a setter in enabled.
@bemerybmw
bemerybmw force-pushed the brem_field_setter_return_result branch from be1c52d to aba3c59 Compare July 22, 2026 14:05
@bemerybmw
bemerybmw marked this pull request as ready for review July 22, 2026 14:38
@bemerybmw
bemerybmw marked this pull request as draft July 22, 2026 14:56
Comment thread score/mw/com/impl/BUILD Outdated
)

cc_library(
name = "shm_compatible_result",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would strongly vote that we do not reimplement score::Result, your statement that we cannot control it is IMHO not true. If we see it like that - then we can also not control std::vector, or map or...Thus, let's use it IMHO and IF at some point in time we would get a problem (which cannot be because it would require dynamic memory allocation on all hot paths) then we can still reimplement it.

Since we check that the pointer is not a nullptr in the function, we can
return a reference so that the caller doesn't have to consider the
nullptr case.
We currently have a race condition between the provider thread moving a
skeleton and a consumer thread calling a setter which accesses the field
which is being moved (SWP-273945). To fix this issue, we access the
event directly which is stored as a unique_ptr so will never be moved.
@bemerybmw
bemerybmw force-pushed the brem_field_setter_return_result branch from aba3c59 to b56ac35 Compare July 23, 2026 06:50
Since the setter / getter functions can fail within the middleware code (e.g. when trying to update the field
value fails), we need to return a result from the setter and getter.
@bemerybmw
bemerybmw force-pushed the brem_field_setter_return_result branch from b56ac35 to e93d55e Compare July 23, 2026 07:22
@bemerybmw
bemerybmw marked this pull request as ready for review July 23, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants