示例#1
0
void DataServeriOS::loop()
{
  _client = _server->available();
  if (_client)
  {
    WaitForRequest();
    ParseReceivedRequest();
    PerformRequestedCommand();
    _client.flush();
    _client.stop();
  }
  else {
    _client.stop();
    _substitudeLoop();
  }
}
示例#2
0
int OverlappedCall::ProcessRequests()
{
	HARDASSERT(::GetCurrentThreadId() == m_dwThreadId);

	DWORD dwRet;
	// Wait until either there is work to do - a terminate exception could be delivered in an APC, 
	// so the wait is interruptable.
	while ((dwRet = WaitForRequest()) == WAIT_OBJECT_0)
	{
		#if TRACING == 1
		{
			TRACELOCK();
			TRACESTREAM << std::hex << GetCurrentThreadId() << L": Calling " << *m_pMethod << "; " << *this << std::endl;
		}
		#endif

		PerformCall();

		#if TRACING == 1
		{
			TRACELOCK();
			TRACESTREAM << std::hex << GetCurrentThreadId() << L": Resting; " << m_dwThreadId << std::endl;
		}
		#endif
	}

	#if TRACING == 1
	{
		TRACELOCK();
		TRACESTREAM << std::hex << GetCurrentThreadId() << L": Exiting (" << dwRet << L"); " << m_dwThreadId << std::endl;
	}
	#endif

	// Allow it to terminate
	return dwRet;
}