Ejemplo n.º 1
0
VOID
ReleasePollTimer()
{
    BOOL bRes;
    DWORD dwErr;

    EnterCriticalSection(&g_CritSectPollRelease);

    #if VERBOSE >= 2
    dprintf("[sync] ReleasePollTimer called\n");
    #endif

    if (!(g_hPollTimer==INVALID_HANDLE_VALUE))
    {
        ResetEvent(g_hPollCompleteEvent);
        bRes = DeleteTimerQueueTimer(NULL, g_hPollTimer, g_hPollCompleteEvent);
        if (bRes==NULL)
        {
            // msdn: If the error code is ERROR_IO_PENDING, it is not necessary to
            // call this function again. For any other error, you should retry the call.
            dwErr = GetLastError();
            if (dwErr != ERROR_IO_PENDING)
                bRes = DeleteTimerQueueTimer(NULL, g_hPollTimer, g_hPollCompleteEvent);
        }

        g_hPollTimer = INVALID_HANDLE_VALUE;
    }

    LeaveCriticalSection(&g_CritSectPollRelease);
}
Ejemplo n.º 2
0
	virtual DWORD OnStop()
	{
		if (hTimer != NULL)
		{
			DeleteTimerQueueTimer(NULL, hTimer, NULL);
			hTimer = NULL;
		}
		if (m_hOneInstance != NULL)
		{
			CloseHandle(m_hOneInstance);
			m_hOneInstance = NULL;
		}
		ReportStatusToSCM(SERVICE_STOP_PENDING);
		if (m_pPlugMgr != NULL)
		{
			m_pPlugMgr->Stop();
		}
		if (m_pLogger)
		{
			m_pLogger->WriteLog(i8desk::LM_INFO, TEXT("I8VDisk Service already stoped."));
			m_pLogger->SetAddDateBefore(false);
			m_pLogger->WriteLog(i8desk::LM_INFO, TEXT("==============================================================\r\n\r\n"));
		}
		ReportStatusToSCM(SERVICE_STOPPED);

		return ERROR_SUCCESS;
	}
Ejemplo n.º 3
0
int _tmain(int argc, _TCHAR* argv[])
{
    HRESULT hr = S_OK;
    HANDLE _hScanTimer;

    if (!CreateTimerQueueTimer(
        &_hScanTimer,
        nullptr, // Use default timer queue
        &s_ScanTimerCallback,
        NULL, // Context
        WLAN_SCAN_TIMER_DELAY, // DueTime
        WLAN_SCAN_TIMER_DELAY, // Period
        WT_EXECUTEDEFAULT // Flags
        ))
    {
        hr = HRESULT_FROM_WIN32(GetLastError());
        printf("CreateTimerQueueTimer failed with result %!HRESULT!\r\n", hr);
    }
    printf("Press any key to exit...\r\n");
    getchar();

    HANDLE hAPCThread = CreateThread(NULL,
        0,
        DeleteTimer,
        _hScanTimer,
        0,
        NULL);

    if (!DeleteTimerQueueTimer(nullptr, _hScanTimer, INVALID_HANDLE_VALUE))
    {
        printf("DeleteTimerQueueTimer failed with result %!HRESULT!", HRESULT_FROM_WIN32(GetLastError()));
    }
    WaitForSingleObject(hAPCThread, INFINITE);
	return 0;
}
Ejemplo n.º 4
0
void CNetManager::ServerClose()
{
	m_pIocpHandler->CloseAllThreads(THREAD_DIE_WAITTIME); // IOCP Worker Thread Close
	ServerLog()->Log("IOCP Worker Thread All Died.");
	m_pProcessThread->End(THREAD_DIE_WAITTIME); // ProcesssThread Close
	ServerLog()->Log("Process Thread Died.");

	// 모든 사용자 종료
	CUserList * pUserList = SMemManager()->GetUserList();
	CUser * pUser = pUserList->GetFirstUser();
	while(pUser != NULL)
	{
		m_pPacketProcess->CloseClient(pUser, false);
		pUser = pUserList->GetNext(pUser);
	}

	m_pAcceptThread->End(THREAD_DIE_WAITTIME);
	ServerLog()->Log("Accept Process Thread Die.");

	// 타이머 해제 윈도우 2000 전용함수 Platform SDK 업데이트 해야됨
	if(!DeleteTimerQueueTimer(NULL, m_hTimerQTimer, NULL))
	{
		ServerLog()->Log("Delete Timer Error.");
	}
	m_hTimerQTimer = NULL;

	CleanMemory();
	InitializeVariable();

	delete SCMemoryManager::GetMemManager(); // 메모리 관리 클래스 소멸
	delete SCProfile::GetProfile(); // Profile 클래스 소멸

	ServerLog()->Log("Server Close.\n");
}
Ejemplo n.º 5
0
void deTimer_disable (deTimer* timer)
{
	if (timer->timer)
	{
		const int	maxTries	= 100;
		HANDLE		waitEvent	= CreateEvent(NULL, FALSE, FALSE, NULL);
		int			tryNdx		= 0;
		DE_ASSERT(waitEvent);

		for (tryNdx = 0; tryNdx < maxTries; tryNdx++)
		{
			BOOL success = DeleteTimerQueueTimer(NULL, timer->timer, waitEvent);
			if (success)
			{
				/* Wait for all callbacks to complete. */
				DWORD res = WaitForSingleObject(waitEvent, INFINITE);
				DE_ASSERT(res == WAIT_OBJECT_0);
				DE_UNREF(res);
				break;
			}
			else
			{
				DWORD err = GetLastError();
				if (err == ERROR_IO_PENDING)
					break; /* \todo [2013-03-21 pyry] Does this mean that callback is still in progress? */
				deYield();
			}
		}

		DE_ASSERT(tryNdx < maxTries);

		CloseHandle(waitEvent);
		timer->timer = 0;
	}
}
Ejemplo n.º 6
0
/**
 * @see pomp_timer_destroy.
 */
static int pomp_timer_win32_destroy(struct pomp_timer *timer)
{
	struct pomp_fd *pfd = NULL;
	POMP_RETURN_ERR_IF_FAILED(timer != NULL, -EINVAL);

	/* Free resources */
	if (timer->htimer != NULL) {
		/* Wait for cancellation */
		DeleteTimerQueueTimer(NULL, timer->htimer,
				INVALID_HANDLE_VALUE);
	}
	if (timer->hevt != NULL) {
		pfd = pomp_loop_win32_find_pfd_by_hevt(
				timer->loop, timer->hevt);
		if (pfd == NULL) {
			POMP_LOGW("hevt %p not found in loop %p",
					timer->hevt, timer->loop);
		} else {
			pomp_loop_remove_pfd(timer->loop, pfd);
			free(pfd);
		}
		CloseHandle(timer->hevt);
	}
	free(timer);
	return 0;
}
Ejemplo n.º 7
0
MyQProgressDialog::~MyQProgressDialog()
{
    if (m_hUpdateTimer)
    {
        DeleteTimerQueueTimer(m_hTimerQueue, m_hUpdateTimer, NULL);
        m_hUpdateTimer = NULL;
    }

    if (m_hTimerQueue)
    {
        DeleteTimerQueueEx(m_hTimerQueue, NULL);
        m_hTimerQueue = NULL;
    }

    if (m_hWinHook)
    {
        UnhookWindowsHookEx(m_hWinHook);
        m_hWinHook = NULL;
    }
    
    if (m_hMouseHook)
    {
        UnhookWindowsHookEx(m_hMouseHook);
        m_hMouseHook = NULL;
    }
}
Ejemplo n.º 8
0
    ~imp() {
#if defined(_WINDOWS) || defined(_CYGWIN)
        DeleteTimerQueueTimer(NULL,
                              m_timer,
                              INVALID_HANDLE_VALUE);
#elif defined(__APPLE__) && defined(__MACH__)
        // Mac OS X

        // If the waiting-thread is not up and waiting yet, 
        // we can make sure that it finishes quickly by 
        // setting the end-time to zero.
        m_end_time.tv_sec = 0;
        m_end_time.tv_nsec = 0;

        // Otherwise it's already up and waiting, and
        // we can send a signal on m_condition_var:
        pthread_mutex_lock(&m_mutex);
        pthread_cond_signal(&m_condition_var);
        pthread_mutex_unlock(&m_mutex);

        if (pthread_join(m_thread_id, NULL) != 0)
            throw default_exception("failed to join thread");
        if (pthread_mutex_destroy(&m_mutex) != 0)
            throw default_exception("failed to destroy pthread mutex");
        if (pthread_cond_destroy(&m_condition_var) != 0)
            throw default_exception("failed to destroy pthread condition variable");
        if (pthread_attr_destroy(&m_attributes) != 0)
            throw default_exception("failed to destroy pthread attributes object");
#elif defined(_LINUX_) || defined(_FREEBSD_)
    // Linux & FreeBSD
        timer_delete(m_timerid);
#else
    // Other Platforms
#endif
    }
Ejemplo n.º 9
0
Archivo: Ticker.c Proyecto: A1kmm/ghc
void
stopTicker(void)
{
    if (timer_queue != NULL && timer != NULL) {
        DeleteTimerQueueTimer(timer_queue, timer, NULL);
        timer = NULL;
    }
}
Ejemplo n.º 10
0
static void
reset_quit_timer() {
  if (timer_handle)
    DeleteTimerQueueTimer(NULL, timer_handle, NULL);

  CreateTimerQueueTimer(&timer_handle, NULL, &WaitOrTimerCallback,
                        NULL, TIMEOUT*1000, 0, 0);
}
Ejemplo n.º 11
0
 void stop()
 {
   if (isRunning()) {
     DeleteTimerQueueTimer(mTimerQueue, mTimerHandle, NULL);
     mTimerHandle = NULL;
     mTimerQueue = NULL;
   }
 }
Ejemplo n.º 12
0
static void win32_stop_timer(struct qemu_alarm_timer *t)
{
    HANDLE hTimer = t->timer;

    if (hTimer) {
        DeleteTimerQueueTimer(NULL, hTimer, NULL);
    }
}
Ejemplo n.º 13
0
bool CScriptDebugging::SetLogfile ( const char* szFilename, unsigned int uiLevel )
{
    assert ( szFilename );

    // Close the previously loaded file
    if ( m_pLogFile )
    {
        fprintf ( m_pLogFile, "INFO: Logging to this file ended\n" );
        // if we have a flush timer
        if ( m_flushTimerHandle != NULL )
        {
            // delete our flush timer
            DeleteTimerQueueTimer ( NULL, m_flushTimerHandle, INVALID_HANDLE_VALUE );   // INVALID_HANDLE_VALUE = wait for running callbacks to finish
        }
        fclose ( m_pLogFile );
        m_pLogFile = NULL;
    }

    // Apply log size limit
    uint uiMaxSizeKB = 0;
    g_pCore->GetCVars ()->Get ( "max_clientscript_log_kb", uiMaxSizeKB );
    CycleFile( szFilename, uiMaxSizeKB );


    // Try to load the new file
    FILE* pFile = fopen ( szFilename, "a+" );
    if ( pFile )
    {
        // [2014-07-09 14:39:31] WARNING: Bad argument @ 'setElementPosition' [Expected element at argument 1, got nil] [string "return addEventHandler("onClientRender", ro..."]
        // length = 158

        // set our buffer size

        // assumed message length of 158

        // if we pulse at 150FPS (unrealistic but whatever)
        // that's 1 update every 6.66666666ms
        // pulse rate is 50 so 50 / 6.6666666 = 7.5 (close enough)
        // if we are doing 5 error messages a pulse that's 5 * 7.5
        // 5 * 7.5 = 37.5
        // we need room for at least 37.5 messages in this buffer
        // round 37.5 to 38 because we can't have half a message
        // 8 * 256 bytes = 6004B
        // round 6004 up to the nearest divisible by 1024 = 6144
        // we have our buffer size.
        setvbuf ( pFile , NULL , _IOFBF , 6144 );

        // Set the new pointer and level and return true
        m_uiLogFileLevel = uiLevel;
        m_pLogFile = pFile;

        // Create a timer
        ::CreateTimerQueueTimer( &m_flushTimerHandle, NULL, TimerProc, NULL, 50, 50, WT_EXECUTEINTIMERTHREAD );
        return true;
    }

    return false;
}
Ejemplo n.º 14
0
int TestSynchTimerQueue(int argc, char* argv[])
{
	int index;
	HANDLE hTimerQueue;
	HANDLE hTimers[TIMER_COUNT];
	APC_DATA apcData[TIMER_COUNT];

	g_Event = CreateEvent(NULL, TRUE, FALSE, NULL);

	hTimerQueue = CreateTimerQueue();

	if (!hTimerQueue)
	{
		printf("CreateTimerQueue failed (%d)\n", (int) GetLastError());
		return -1;
	}

	for (index = 0; index < TIMER_COUNT; index++)
	{
		apcData[index].TimerId = index;
		apcData[index].StartTime = GetTickCount();
		apcData[index].DueTime = (index * 100) + 500;
		apcData[index].Period = 1000;
		apcData[index].FireCount = 0;

		if (!CreateTimerQueueTimer(&hTimers[index], hTimerQueue, (WAITORTIMERCALLBACK) TimerRoutine,
				&apcData[index], apcData[index].DueTime, apcData[index].Period, 0))
		{
			printf("CreateTimerQueueTimer failed (%d)\n", (int) GetLastError());
			return -1;
		}
	}

	if (WaitForSingleObject(g_Event, INFINITE) != WAIT_OBJECT_0)
	{
		printf("WaitForSingleObject failed (%d)\n", (int) GetLastError());
		return -1;
	}

	for (index = 0; index < TIMER_COUNT; index++)
	{
		if (!DeleteTimerQueueTimer(hTimerQueue, hTimers[index], NULL))
		{
			printf("DeleteTimerQueueTimer failed (%d)\n", (int) GetLastError());
			return -1;
		}
	}
	
	if (!DeleteTimerQueue(hTimerQueue))
	{
		printf("DeleteTimerQueue failed (%d)\n", (int) GetLastError());
		return -1;
	}

	CloseHandle(g_Event);

	return 0;
}
Ejemplo n.º 15
0
void setSharedTimerFireInterval(double interval)
{
    ASSERT(sharedTimerFiredFunction);

    unsigned intervalInMS;
    interval *= 1000;
    if (interval > USER_TIMER_MAXIMUM)
        intervalInMS = USER_TIMER_MAXIMUM;
    else
        intervalInMS = static_cast<unsigned>(interval);

    initializeOffScreenTimerWindow();
    bool timerSet = false;

#if !OS(WINCE)
    if (Settings::shouldUseHighResolutionTimers()) {
        if (interval < highResolutionThresholdMsec) {
            if (!highResTimerActive) {
                highResTimerActive = true;
                timeBeginPeriod(timerResolution);
            }
            SetTimer(timerWindowHandle, endHighResTimerID, stopHighResTimerInMsec, 0);
        }

        DWORD queueStatus = LOWORD(GetQueueStatus(QS_PAINT | QS_MOUSEBUTTON | QS_KEY | QS_RAWINPUT));

        // Win32 has a tri-level queue with application messages > user input > WM_PAINT/WM_TIMER.

        // If the queue doesn't contains input events, we use a higher priorty timer event posting mechanism.
        if (!(queueStatus & (QS_MOUSEBUTTON | QS_KEY | QS_RAWINPUT))) {
            if (intervalInMS < USER_TIMER_MINIMUM && !processingCustomTimerMessage && !(queueStatus & QS_PAINT)) {
                // Call PostMessage immediately if the timer is already expired, unless a paint is pending.
                // (we prioritize paints over timers)
                if (InterlockedIncrement(&pendingTimers) == 1)
                    PostMessage(timerWindowHandle, timerFiredMessage, 0, 0);
                timerSet = true;
            } else {
                // Otherwise, delay the PostMessage via a CreateTimerQueueTimer
                if (!timerQueue)
                    timerQueue = CreateTimerQueue();
                if (timer)
                    DeleteTimerQueueTimer(timerQueue, timer, 0);
                timerSet = CreateTimerQueueTimer(&timer, timerQueue, queueTimerProc, 0, intervalInMS, 0, WT_EXECUTEINTIMERTHREAD | WT_EXECUTEONLYONCE);
            }
        }
    }
#endif // !OS(WINCE)

    if (timerSet) {
        if (timerID) {
            KillTimer(timerWindowHandle, timerID);
            timerID = 0;
        }
    } else {
        timerID = SetTimer(timerWindowHandle, sharedTimerID, intervalInMS, 0);
        timer = 0;
    }
}
Ejemplo n.º 16
0
void GamePhase::CheckCollision()
{
	
	for (size_t i = 0; i < GamePhase::playerPath.size() - 1; i++)
	{
		if (GamePhase::enemy.first == GamePhase::playerPath[i].first && GamePhase::enemy.second == GamePhase::playerPath[i].second)
		{
			// enemy fail

			// klavesy
			Reader::RemovePair('w', GamePhase::up);
			Reader::RemovePair('a', GamePhase::left);
			Reader::RemovePair('s', GamePhase::down);
			Reader::RemovePair('d', GamePhase::right);

			// timer
			DeleteTimerQueueTimer(NULL, GamePhase::waitHandle, NULL);

			GamePhase::returnFunctionCorrect();

			return;
		}
	}
	
	for (size_t i = 0; i < GamePhase::enemyPath.size() - 1; i++)
	{
		if (GamePhase::player.first == GamePhase::enemyPath[i].first && GamePhase::player.second == GamePhase::enemyPath[i].second)
		{
			// player fail

			// klavesy
			Reader::RemovePair('w', GamePhase::up);
			Reader::RemovePair('a', GamePhase::left);
			Reader::RemovePair('s', GamePhase::down);
			Reader::RemovePair('d', GamePhase::right);

			// timer
			DeleteTimerQueueTimer(NULL, GamePhase::waitHandle, NULL);

			GamePhase::returnFunctionBad();

			return;
		}
	}
}
Ejemplo n.º 17
0
/*
 ÏìÓ¦°ü´¦Àíº¯Êý£¬½«ÏìÓ¦ÄÚÈÝÖ±½ÓÉÏËÍ ÔÚµ÷ÓÃÍê³Éºó»ØÊÕSOCKET
 Èë²Î: thisÖ¸Õë
 ·µ»ØÖµ ³É¹¦ VOS_OK  ʧ°Ü VOS_ERROR
 */
 UINT32 IpappDispatchResponse(PKT_HEAD_S* pThis)
 {
  //Èë²Î¼ì²é
   CHECK_PARAM(pThis);
   
   UINT32 uiRet = VOS_OK;
   map<UINT32, IPAPP_LOCAL_BUF_S>::iterator iter = g_PktMap.find(pThis->uiPktID);
   
  if ( iter != g_PktMap.end())// -->TEST_CODE;
  {
    //ÏÈÍ£Ö¹¶¨Ê±Æ÷
    DeleteTimerQueueTimer(iter->second.hTimerQueue, iter->second.hNewTimer, NULL);
    DeleteTimerQueue(iter->second.hTimerQueue);
    
    if(iter->second.callback_pfn != NULL)
    {
      pfn pfnKey = iter->second.callback_pfn;
      IPAPP_RESPONSE_PACKET_S* pPkt = (IPAPP_RESPONSE_PACKET_S* )(pThis + 1);
      
      /*
       if(FUNCTION_NOT_FOUND == pPkt->uiErrCode) //·þÎñÆ÷¶ËδÕÒµ½º¯Êý
       {
       no_function();
       return VOS_OK;
       }
       */
       
       size_t szPktLength = sizeof(IPAPP_RESPONSE_PACKET_S) + pPkt->stRetArgs.szLen;
       if(pPkt->stRetArgs.szLen != 0)
       {
        pPkt->stRetArgs.Buf = (char *)pPkt + sizeof(IPAPP_RESPONSE_PACKET_S);
      }
      else
      {
        pPkt->stRetArgs.Buf = NULL;
      }
      
      //µ÷ÓöÔÓ¦»Øµ÷º¯Êý
      //uiRet = UPLOADMSG(pMsg);
      CHAR *pArgList = (char *)pPkt->stRetArgs.Buf;
      pfnKey(pPkt->uiErrCode, pArgList, pPkt->stRetArgs.szLen, pPkt->context, (HANDLE)pThis->uiPktID);
    }
    
    IpappClearMap(pThis->uiPktID);
    
    //µ÷ÓÃÍê³É »ØÊÕÌ×½Ó×Ö
    if(SockCloseSocket((SOCKET)pThis->uiPktID))
    {
      printf("RESTORE SOCKET ERROR\n");
    }
    //printf("SOCKET IS ALREADY CLOSED\n");
    
  }
  
  return VOS_OK;
}
Ejemplo n.º 18
0
void DisposeHttpListener(PHTTP_LISTENER listener)
{	
	ULONG state = InterlockedCompareExchange(&listener->State, 
											HTTP_LISTENER_STATE_DISPOSING, 
											HTTP_LISTENER_STATE_STARTED);
	if(state = HTTP_LISTENER_STATE_STOPPED)
	{
		return;
	}

	// Thread responsible for disposing the listener.
	if(state = HTTP_LISTENER_STATE_STARTED)
	{		
		if(listener && listener->hRequestQueue)
		{
			for(int i=1; i<=listener->urlsCount; i++)
			{
				HttpRemoveUrlFromUrlGroup(
					  listener->UrlGroupId,     // Req Queue
					  listener->urls[i],        // Fully qualified URL
					  NULL);
			}

			//Close the request queue.
			CloseHandle(listener->hRequestQueue);
		}

		// 
		// Call HttpTerminate.
		//
		HttpTerminate(HTTP_INITIALIZE_SERVER, NULL);
		return;
	} 
	else if (state == HTTP_LISTENER_STATE_DISPOSING)
	{
		// Only one thread can dispose the listener	
		if(InterlockedCompareExchange(&listener->State, 
									HTTP_LISTENER_STATE_STOPPED, 
									HTTP_LISTENER_STATE_DISPOSING) == HTTP_LISTENER_STATE_DISPOSING)
		{		
			//
			// Cleanup threadpool 
			//
			HttpListenerCleanupThreadPool(listener);		
		
			//Delete timers and release the IOContexts
			DeleteTimerQueueTimer(listener->TimerQueue, listener->FlushTimer,NULL);
			DeleteTimerQueue(listener->TimerQueue);
			HttpListenerFlushLookasideThreadProc(listener,NULL);

			// Free the listener
			FREE_MEM(listener);
			printf("Http listener terminated...\n");
		}
	}
}
Ejemplo n.º 19
0
/*************************************************************************
**
**    Function      : canClose_driver 
**
**    Description   : Close the message and control channel
**    Parameters    : CAN_HANDLE inst		- handle for CAN controller 
**    Returnvalue   : 
**   
*************************************************************************/
 int __stdcall canClose_driver(CAN_HANDLE inst)
   {
	printf("CAN close \n");
	canControlReset(hCanCtl);
	canChannelClose(hCanChn);
	canControlClose(hCanCtl);
	vciDeviceClose(hDevice);
	DeleteTimerQueueTimer(NULL,hTimerHandle,NULL); 
   return 1;
   }
Ejemplo n.º 20
0
void WiFiInfo::Impl::GetApnsAndNotifyClient()
{
  vector<WiFiInfo::AccessPoint> apns;
  PWLAN_INTERFACE_INFO_LIST pIfList = NULL;
  DWORD dwResult = WlanEnumInterfaces(m_hClient, NULL, &pIfList);
  if (dwResult == ERROR_SUCCESS)
  {
    for (int ifIndex = 0; ifIndex < static_cast<int>(pIfList->dwNumberOfItems); ++ifIndex)
    {
      PWLAN_INTERFACE_INFO pIfInfo = (PWLAN_INTERFACE_INFO)&pIfList->InterfaceInfo[ifIndex];
      PWLAN_BSS_LIST pWlanBssList = NULL;
      if (pWlanGetNetworkBssList)
      { // on WinXP we don't have this function :(
        dwResult = pWlanGetNetworkBssList(m_hClient,
                                         &pIfInfo->InterfaceGuid,
                                         0,
                                         dot11_BSS_type_any,
                                         FALSE,
                                         NULL,
                                         &pWlanBssList);
        if (dwResult == ERROR_SUCCESS)
        {
          for (int wlanIndex = 0; wlanIndex < static_cast<int>(pWlanBssList->dwNumberOfItems); ++wlanIndex)
          {
            PWLAN_BSS_ENTRY pBssEntry = &pWlanBssList->wlanBssEntries[wlanIndex];
            WiFiInfo::AccessPoint apn;
            apn.m_ssid.assign(&pBssEntry->dot11Ssid.ucSSID[0],
                              &pBssEntry->dot11Ssid.ucSSID[pBssEntry->dot11Ssid.uSSIDLength]);
            char buff[20] = {};
            sprintf(buff, "%02X-%02X-%02X-%02X-%02X-%02X",
                    pBssEntry->dot11Bssid[0], pBssEntry->dot11Bssid[1],
                    pBssEntry->dot11Bssid[2], pBssEntry->dot11Bssid[3],
                    pBssEntry->dot11Bssid[4], pBssEntry->dot11Bssid[5]);
            apn.m_bssid = buff;
            sprintf(buff, "%ld", pBssEntry->lRssi);
            apn.m_signalStrength = buff;
            apns.push_back(apn);
          }
          WlanFreeMemory(pWlanBssList);
        }
      }
    }
    WlanFreeMemory(pIfList);
  }

  m_callback(apns);

  // on WinXP, clean up timer if it was used
  if (m_timer)
  {
    DeleteTimerQueueTimer(NULL, m_timer, NULL);
    m_timer = NULL;
  }
}
Ejemplo n.º 21
0
void stopSharedTimer()
{
    if (timerQueue && timer) {
        DeleteTimerQueueTimer(timerQueue, timer, 0);
        timer = 0;
    }

    if (timerID) {
        KillTimer(timerWindowHandle, timerID);
        timerID = 0;
    }
}
Ejemplo n.º 22
0
EXEC_RETURN timer_Close(TIMER_ID* timer_id){
#if defined(WIN32) || defined(_WIN64)
	BOOL res = DeleteTimerQueueTimer(NULL,timer_id->id,NULL);
	if(res == FALSE && GetLastError() == ERROR_IO_PENDING)
		res = TRUE;
	return res ? EXEC_SUCCESS:EXEC_ERROR;
#elif __linux__
	return timer_delete(timer_id->id) == 0 ? EXEC_SUCCESS:EXEC_ERROR;
#elif __APPLE__
	return close(timer_id->kq) == 0 ? EXEC_SUCCESS:EXEC_ERROR;
#endif
}
Ejemplo n.º 23
0
Archivo: timer.c Proyecto: lengue/tsip
VOID TIMER_Stop(ULONG ulHandle)
{
    if ((ulHandle >= TIMER_CB_NUM)
      ||(g_pstTimerCB[ulHandle].ucIsUsed == FALSE))
    {
        return;
    }

    DeleteTimerQueueTimer(NULL, g_pstTimerCB[ulHandle].hTimer, NULL);
    TIMER_ReleaseCB(ulHandle);
    return;
}
Ejemplo n.º 24
0
void vlc_timer_destroy (vlc_timer_t timer)
{
#ifndef UNDER_CE
    if (timer->handle != INVALID_HANDLE_VALUE)
        DeleteTimerQueueTimer (NULL, timer->handle, INVALID_HANDLE_VALUE);
#else
    if (timer->id)
        timeKillEvent (timer->id);
    /* FIXME: timers that have not yet completed will trigger use-after-free */
#endif
    free (timer);
}
Ejemplo n.º 25
0
void Timer::stop()
{
    if(timerHandle != NULL)
    {
        if(mTimer.lock() != WAIT_OBJECT_0)
            throw RobotException("Timer::stop could not get lock!");

        DeleteTimerQueueTimer(NULL, timerHandle, INVALID_HANDLE_VALUE);
        timerHandle = NULL;

        mTimer.unlock();
    }
}
Ejemplo n.º 26
0
	Component* Destroy()
	{
		if (mhTimer != nullptr)
		{
			DeleteTimerQueueTimer(nullptr, mhTimer, nullptr);
			mhTimer = nullptr;
		}

		if (mpComponent->destroy() != OPROS_SUCCESS)
			return nullptr;
		else
			return mpComponent;
	}
Ejemplo n.º 27
0
void
setupTimer(Renderer* renderer)
{	
    runningRenderer = renderer;
    if (renderer) {
        CreateTimerQueueTimer(&timerQueueTimer, NULL, statusTimer, 
            NULL, 250, 250, WT_EXECUTEINTIMERTHREAD);
    } else {
        if (timerQueueTimer) {
            DeleteTimerQueueTimer(NULL, timerQueueTimer, INVALID_HANDLE_VALUE);
        }
    }
}
Ejemplo n.º 28
0
void dspConfigCb::clear_handle_list() const
{
	for( t_size i = 0 , imax = dspConfigCb::h_list.get_count(); i < imax; ++i )
	{
		CONST BOOL ret = DeleteTimerQueueTimer( NULL , *dspConfigCb::h_list[i] , NULL );
		if( ret == 0 )
		{
			console::printf( CONSOLE_HEADER "%s(): DeleteTimerQueueTimer() failed" , __FUNCTION__ );
		}
		delete dspConfigCb::h_list[i];
	}
	dspConfigCb::h_list.remove_all();
	return;
}
Ejemplo n.º 29
0
void ArtWindow::OnDestroy()
{
	delete renderer;
	//KillTimer(TIMER_REPAINT);

	if (RepaintTimer)
		DeleteTimerQueueTimer(TimerQueue, RepaintTimer, INVALID_HANDLE_VALUE);
	if (TimerQueue)
		DeleteTimerQueue(TimerQueue);

	// Does this do anything?
	RepaintTimer = NULL;
	TimerQueue = NULL;
}
Ejemplo n.º 30
0
void stopSharedTimer()
{
#if !OS(WINCE)
    if (timerQueue && timer) {
        DeleteTimerQueueTimer(timerQueue, timer, 0);
        timer = 0;
    }
#endif

    if (timerID) {
        KillTimer(timerWindowHandle, timerID);
        timerID = 0;
    }
}