Beispiel #1
0
boost::chrono::steady_clock::time_point CQuoteStore::Get( 
	boost::chrono::steady_clock::time_point timestamp, entity::Quote* outQuote )
{
	static boost::chrono::steady_clock::time_point zeroPoint;
	if(timestamp == zeroPoint 
		&& m_quoteTimestamp > zeroPoint)
	{
		// It's the first time of Fetcher getting quote and 
		// store already has cached quote
		GetQuote(outQuote);
	}
	else
	{
		boost::unique_lock<boost::mutex> lock(m_quoteMutex);
		if(!m_isEnd)
		{
			m_cond.wait(lock);

			if(m_quoteTimestamp > timestamp)
				GetQuote(outQuote);
		}
	}
	
	return m_quoteTimestamp;
}
LRESULT CMFToolbar::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	if (!HIWORD(wParam))
	{
		long lSite = LOWORD(wParam);
		if ( lSite == IDM_GETQUOTE)
		{
			GetQuote();
			return 0;
		}
	}
	return -1;
}
LRESULT CMFToolbar::OnGetQuote(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	GetQuote();
	return 0;
}