23 template <
typename Observable,
typename Traits>
25 using T =
typename Traits::element_type;
28 template <
typename...
Args>
44 std::shared_ptr<const T>
get() {
62 bool expected =
false;
76 auto newValuePtr = newValue.get();
78 throw std::logic_error(
"Observable returned nullptr.");
81 return newValuePtr != newValue.get();
96 template <
typename Observable,
typename Traits>
97 template <
typename...
Args>
101 template <
typename Observable,
typename Traits>
108 class ContextMasterPointer {
110 explicit ContextMasterPointer(std::shared_ptr<Context>
context)
113 contextMaster_.get(),
114 [destroyBaton = destroyBaton_](
Context*) {
115 destroyBaton->post();
117 ~ContextMasterPointer() {
120 destroyBaton_->wait();
123 ContextMasterPointer(
const ContextMasterPointer&) =
delete;
124 ContextMasterPointer(ContextMasterPointer&&) =
default;
125 ContextMasterPointer& operator=(
const ContextMasterPointer&) =
delete;
126 ContextMasterPointer& operator=(ContextMasterPointer&&) =
default;
129 return contextMaster_.
get();
132 std::weak_ptr<Context> get_weak() {
137 std::shared_ptr<folly::Baton<>> destroyBaton_{
138 std::make_shared<folly::Baton<>>()};
139 std::shared_ptr<Context> contextMaster_;
147 ContextMasterPointer contextMaster(
context_);
148 auto contextWeak = contextMaster.get_weak();
154 if (
auto context = contextWeak.lock()) {
static void scheduleRefreshNewVersion(Core::WeakPtr coreWeak)
void swap(Synchronized &rhs)
void subscribe(uint32_t iters, int N)
Observer< T > getObserver()&&
constexpr detail::Map< Move > move
ObserverCreator(Args &&...args)
observer_detail::Core::WeakPtr coreWeak_
std::shared_ptr< const T > get()
internal::ArgsMatcher< InnerMatcher > Args(const InnerMatcher &matcher)
—— Concurrent Priority Queue Implementation ——
folly::Synchronized< std::shared_ptr< const T > > value_
Observer< observer_detail::ResultOfUnwrapSharedPtr< F > > makeObserver(F &&creator)
void setCore(observer_detail::Core::WeakPtr coreWeak)
~ObserverCreatorContext()
std::atomic< bool > updateRequested_
std::shared_ptr< Context > context_
std::weak_ptr< Core > WeakPtr
ObserverCreatorContext(Args &&...args)
void subscribe(F &&callback)
PUSHMI_INLINE_VAR constexpr detail::get_fn< T > get
void copy(T *target) const
typename Traits::element_type T