|
| void | commit(lock_t&& lock, const value_t& value) |
| | server calls this once it has decided on(and, if needed, persisted) the actual value to accept - wakes every registered listener.
|
| os_result | exchange(const void* in, size_t size_in, void* out, size_t size_out, size_t& size) |
| | the value as an IOCTL: in the wish, out the value - either may be absent
|
| | operator const value_t&() |
| promoted& | operator ++() |
| value_t | operator ++(int) |
| promoted& | operator +=(const value_t& delta) |
| | a counted value steps under the lock: concurrent steps never lose one, a step below zero stops at it, the postfix forms return what they stepped from
|
| promoted& | operator --() |
| value_t | operator --(int) |
| promoted& | operator -=(const value_t& delta) |
| promoted& | operator =(const value_t& value) |
| | promoted(class broadcast& broadcast, const value_t& value, server_t&& server) |
| | promoted(class broadcast& broadcast, server_t&& server) |
template<typename value_t, typename server_t>
class dxd::promoted< value_t, server_t >
kernel-mode promoted value, mirroring dx::promoted's server/commit/notify shape
Same concept as dx::promoted(dx_value.h): a value that funnels every write through a pluggable server callback(validate/align/persist, then commit()), caches the committed value for reads, and notifies interested parties of every change - without dx::promoted's std::mutex/std::function/dx::listen, none of which are kernel-safe.
Two differences in kind, both forced by the kernel environment rather than a narrowing of the concept:
- server_t is a template parameter (the caller's lambda/functor type), not a std::function value - the same "inject arbitrary validation logic per
promoted member" pattern, resolved at compile time instead of via a type-erased, heap-allocating closure.
- notify is dxd::broadcast::signal() (wake registered listeners, who then re-read the value themselves), not dx::listen's std::function<void(value_t)> push - listeners here are as likely to be a dxd::event<dxd::user> bridging into a different process as an in-process callback, and a pushed value has no meaning across that boundary the way a signal-then-pull does.
No C++ exceptions (kernel code doesn't use them - see dxd/CLAUDE.md): the server callback is expected to call commit() itself when a value is accepted, exactly like dx::promoted's server contract already documents; a server that declines a change simply doesn't call commit(), leaving the previous value in place - there is no thrown rejection to report back to operator=()'s caller. Reentrancy (writing while a write is already in flight) is defended against by no-op'ing rather than throwing.