RTTimerCreate-generic.cpp revision cacc4e75dbbff469c10a505168208f064c6c385c
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync/** $Id$ */
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync/** @file
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync * innotek Portable Runtime - Timers, Generic RTTimerCreate() Implementation.
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync */
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync/*
c98fb3e16fcd571a790eab772c0c66173d225205vboxsync * Copyright (C) 2006-2007 innotek GmbH
c98fb3e16fcd571a790eab772c0c66173d225205vboxsync *
c98fb3e16fcd571a790eab772c0c66173d225205vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
c98fb3e16fcd571a790eab772c0c66173d225205vboxsync * available from http://www.virtualbox.org. This file is free software;
c98fb3e16fcd571a790eab772c0c66173d225205vboxsync * you can redistribute it and/or modify it under the terms of the GNU
c98fb3e16fcd571a790eab772c0c66173d225205vboxsync * General Public License as published by the Free Software Foundation,
c98fb3e16fcd571a790eab772c0c66173d225205vboxsync * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
c98fb3e16fcd571a790eab772c0c66173d225205vboxsync * distribution. VirtualBox OSE is distributed in the hope that it will
c98fb3e16fcd571a790eab772c0c66173d225205vboxsync * be useful, but WITHOUT ANY WARRANTY of any kind.
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync */
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync/*******************************************************************************
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync* Header Files *
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync*******************************************************************************/
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync#include <iprt/timer.h>
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync#include <iprt/err.h>
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync#include <iprt/assert.h>
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync
cacc4e75dbbff469c10a505168208f064c6c385cvboxsyncRTDECL(int) RTTimerCreate(PRTTIMER *ppTimer, unsigned uMilliesInterval, PFNRTTIMER pfnTimer, void *pvUser)
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync{
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync int rc = RTTimerCreateEx(ppTimer, uMilliesInterval * UINT64_C(1000000), 0, pfnTimer, pvUser);
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync if (RT_SUCCESS(rc))
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync {
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync rc = RTTimerStart(*ppTimer, 0);
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync if (RT_SUCCESS(rc))
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync return rc;
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync int rc2 = RTTimerDestroy(*ppTimer); AssertRC(rc2);
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync *ppTimer = NULL;
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync }
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync return rc;
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync}
cacc4e75dbbff469c10a505168208f064c6c385cvboxsync