Skip to content

Instantly share code, notes, and snippets.

@jsbattig
Last active August 29, 2015 13:57
Show Gist options
  • Save jsbattig/9379100 to your computer and use it in GitHub Desktop.
Save jsbattig/9379100 to your computer and use it in GitHub Desktop.
SvcBusThreadPoolTimer constructor method (with bug)
int SvcBusThreadPoolTimer_init( SvcBusThreadPoolTimer* _this, SvcBusThreadPool* pool, SvcBusThreadPool_callback callback, void* context, unsigned int millis )
{
FILETIME FileDueTime;
ULARGE_INTEGER ulDueTime;
_this->timer = CreateThreadpoolTimer( &SvcBusThreadPoolTimer_TimerCallback, _this, &pool->pcbe );
if( _this->timer == NULL )
{
return SVCBUS_THREADPOOL_ERROR;
}
_this->context = context;
_this->thread_id = 0;
_this->callback = callback;
ulDueTime.QuadPart = millis * 10 /* 100 nanosecond increments per microsecond */ * 1000 /* microseconds per millisecond */;
FileDueTime.dwHighDateTime = ulDueTime.HighPart;
FileDueTime.dwLowDateTime = ulDueTime.LowPart;
SetThreadpoolTimer( _this->timer, &FileDueTime, millis, 0 );
return SVCBUS_THREADPOOL_OK;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment