Exemplo n.º 1
0
/* XXX Handle timer rollover? */
void Scheduler::DequeueAndUpdateTimeout()
{
	LOG_AM_TRACE("Entering function %s", __FUNCTION__);

	/* Nothing to do?  Then return.  A new timeout will be scheduled
	 * the next time something is queued */
	if (m_queue.empty() && (!m_localOffsetSet || m_localQueue.empty())) {
		LOG_AM_DEBUG("Not dequeuing any items as queue is now empty");
		if (m_wakeScheduled) {
			CancelTimeout();
			m_wakeScheduled = false;
		}
		return;
	}

	time_t	curTime = time(NULL);

	LOG_AM_DEBUG("Beginning to dequeue items at time %llu",
		(unsigned long long)curTime);

	/* If anything on the queue already happened in the past, dequeue it
	 * and mark it as Scheduled(). */

	ProcessQueue(m_queue, curTime);

	/* Only process the local queue if the timezone offset is known.
	 * Otherwise, wait, because it will be known shortly. */
	if (m_localOffsetSet) {
		ProcessQueue(m_localQueue, curTime + m_localOffset);
	}

	LOG_AM_DEBUG("Done dequeuing items");

	/* Both queues scheduled and dequeued (or unknown if time zone is not
	 * yet known)? */
	if (m_queue.empty() && (!m_localOffsetSet || m_localQueue.empty())) {
		LOG_AM_DEBUG("No unscheduled items remain");

		if (m_wakeScheduled) {
			CancelTimeout();
			m_wakeScheduled = false;
		}

		return;
	}

	time_t nextWakeup = GetNextStartTime();

	if (!m_wakeScheduled || (nextWakeup != m_nextWakeup)) {
		UpdateTimeout(nextWakeup, curTime);
		m_nextWakeup = nextWakeup;
		m_wakeScheduled = true;
	}
}
void CUT_PBASE_T_USBDI_0480::HostDoCancel()
	{
	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0480_HOSTDOCANCEL_ENTRY, this );
	
	CancelTimeout();
	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0480_HOSTDOCANCEL_EXIT, this );
	}
void CUT_PBASE_T_USBDI_0481::HostDoCancel()
	{
	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0481_HOSTDOCANCEL_ENTRY, this );
	
	// Cancel the test step action timeout timer	
	CancelTimeout();
	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0481_HOSTDOCANCEL_EXIT, this );
	}
    void CUT_PBASE_T_USBDI_1231::HostDoCancel()
        {
        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_HOSTDOCANCEL_ENTRY, this );

        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP03, "====> HostDoCancel entry priority = %d", RThread().Priority());

        // Cancel the timeout timer
        CancelTimeout();
        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_HOSTDOCANCEL_EXIT, this );
        }