本文整理汇总了C++中boost::promise::set_value方法的典型用法代码示例。如果您正苦于以下问题:C++ promise::set_value方法的具体用法?C++ promise::set_value怎么用?C++ promise::set_value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::promise
的用法示例。
在下文中一共展示了promise::set_value方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ramhog_gen_pad_mt
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);
}
示例2: accumulate
void accumulate(boost::promise<int> &p)
{
int sum = 0;
for (int i = 0; i < 5; ++i)
sum += i;
p.set_value(sum);
}
示例3: promise_task
void promise_task(boost::promise<std::string> & promise)
{
std::cout << "promise_task" << std::endl;
// sleep (2);
promise.set_value("PROMISE");
}
示例4:
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();
};
示例5: wrap_as_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());
}
示例6: send
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;
}
}
示例7: wait_callback
void wait_callback(boost::promise<int>& pi)
{
boost::lock_guard<boost::mutex> lk(callback_mutex);
++callback_called;
try
{
pi.set_value(42);
}
catch(...)
{
}
}
示例8: func5
void func5(boost::promise<void> p)
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
p.set_value();
}
示例9: func3
void func3(boost::promise<int&> p)
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(500));
j = 5;
p.set_value(j);
}
示例10: func5
void func5(boost::promise<void> p)
{
boost::this_thread::sleep_for(ms(500));
p.set_value();
}
示例11: func3
void func3(boost::promise<int&> p)
{
boost::this_thread::sleep_for(ms(500));
j = 5;
p.set_value(j);
}
示例12: func1
void func1(boost::promise<int> p)
{
boost::this_thread::sleep_for(ms(500));
p.set_value(3);
}