static void ramhog_gen_pad_mt(boost::promise<bool> &done, const uint8_t *input, size_t input_size, uint32_t C, uint32_t padIndex, uint64_t *padOut, bool fForMiner, CBlockIndex *pindexForBest) { if (fForMiner && pindexForBest != pindexBest) { done.set_value(error("ramhog_gen_pad_mt(): Interrupted from new best block")); return; } ramhog_gen_pad(input, input_size, C, padIndex, padOut); done.set_value(true); }
void accumulate(boost::promise<int> &p) { int sum = 0; for (int i = 0; i < 5; ++i) sum += i; p.set_value(sum); }
void promise_task(boost::promise<std::string> & promise) { std::cout << "promise_task" << std::endl; // sleep (2); promise.set_value("PROMISE"); }
boost::future<autobahn::wamp_authenticate> on_challenge(const autobahn::wamp_challenge& challenge) { std::cerr << "responding to auth challenge: " << challenge.challenge() << std::endl; std::string signature = compute_wcs(m_secret, challenge.challenge()); challenge_future.set_value( autobahn::wamp_authenticate(signature) ); std::cerr << "signature: " << signature << std::endl; return challenge_future.get_future(); };
virtual boost::unique_future<bool> send(const safe_ptr<read_frame>& frame) override { bool pushed = frame_buffer_.try_push(frame); if (pushed && !first_frame_reported_) { first_frame_promise_.set_value(); first_frame_reported_ = true; } return caspar::wrap_as_future(is_running_.load()); }
virtual void send(const safe_ptr<basic_frame>& src_frame) override { bool pushed = frame_buffer_.try_push(src_frame); // frame_buffer_.push(src_frame); if (pushed && !first_frame_reported_) //changed to fix compilation //if (!first_frame_reported_) { first_frame_promise_.set_value(); first_frame_reported_ = true; } }
void wait_callback(boost::promise<int>& pi) { boost::lock_guard<boost::mutex> lk(callback_mutex); ++callback_called; try { pi.set_value(42); } catch(...) { } }
void func5(boost::promise<void> p) { boost::this_thread::sleep_for(boost::chrono::milliseconds(500)); p.set_value(); }
void func3(boost::promise<int&> p) { boost::this_thread::sleep_for(boost::chrono::milliseconds(500)); j = 5; p.set_value(j); }
void func5(boost::promise<void> p) { boost::this_thread::sleep_for(ms(500)); p.set_value(); }
void func3(boost::promise<int&> p) { boost::this_thread::sleep_for(ms(500)); j = 5; p.set_value(j); }
void func1(boost::promise<int> p) { boost::this_thread::sleep_for(ms(500)); p.set_value(3); }