| 144 | TSystemEvent* readyEvent = nullptr; |
| 145 | |
| 146 | with_lock (StateLock) { |
| 147 | TAtomicBase state = AtomicGet(State); |
| 148 | if (Y_UNLIKELY(state != NotReady)) { |
| 149 | return false; |
| 150 | } |
| 151 | |
| 152 | new (&Value) T(std::forward<TT>(value)); |
| 153 | |
| 154 | readyEvent = ReadyEvent.Get(); |
| 155 | |
| 156 | AtomicSet(State, ValueSet); |
| 157 | } |
| 158 | |
| 159 | if (readyEvent) { |
| 160 | readyEvent->Signal(); |