thread.cpp revision bd8e360cd1db83dcb2694ea9122ce3bc5bae678a
/** @file
*
* VirtualBox additions client application: thread class.
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include <iostream> /* For std::exception */
#include "thread.h"
/** Stop the thread using its stop method and get the exit value.
* @returns iprt status code
* @param cMillies The number of milliseconds to wait. Use RT_INDEFINITE_WAIT for
* an indefinite wait. Only relevant if the thread is
* waitable.
* @param prc Where to store the return code of the thread. Optional.
*/
{
int rc = VINF_SUCCESS;
{
return VERR_INTERNAL_ERROR;
}
mExit = true;
if (0 != (mFlags & RTTHREADFLAGS_WAITABLE))
{
if (RT_SUCCESS(rc))
{
}
else
{
}
}
return rc;
}
/** Destroy the class, stopping the thread if necessary. */
VBoxGuestThread::~VBoxGuestThread(void)
{
if (NIL_RTTHREAD != mSelf)
{
stop(1000, 0);
}
}
/** Start the thread. */
int VBoxGuestThread::start(void)
{
{
return VERR_INTERNAL_ERROR;
}
mExit = false;
}
/** Yield the CPU */
bool VBoxGuestThread::yield(void)
{
return RTThreadYield();
}
/** The "real" thread function for the VBox runtime. */
{
int rc = VINF_SUCCESS;
try
{
}
{
}
catch (...)
{
LogRelFunc(("Caught unknown exception in thread.\n"));
}
return rc;
}