thread.h revision b72771e8c6ba3b3d9ebdd7977730325131ae0f98
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * VirtualBox additions client application: thread class.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * available from http://www.virtualbox.org. This file is free software;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * General Public License (GPL) as published by the Free Software
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * additional information or have any questions.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/** Virtual parent class for thread functions for the VBoxGuestThread class. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync // VBoxGuestThreadFunction(void);
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * The actual thread function.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @returns iprt status code as thread return value
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param pParent the VBoxGuestThread running this thread function
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync virtual int threadFunction(VBoxGuestThread *pPThread) = 0;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Send a signal to the thread function that it should exit. This should not block.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync/** C++ wrapper for VBox runtime threads. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync // Private member variables
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** The thread function for this thread */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** The size of the stack for the new thread. Use 0 for the default stack size. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** The thread type. Used for deciding scheduling attributes of the thread. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** Flags of the RTTHREADFLAGS type (ORed together). */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** Thread name */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync const char *mName;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** The VBox runtime thread handle. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** Is the thread currently running? */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync volatile bool mRunning;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** Should the thread be stopped? */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync volatile bool mExit;
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync // Typedefs
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync /** Ourselves, for use in the thread function. */
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Initialise the class.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param pFunction the thread function for this thread
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param cbStack The size of the stack for the new thread.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * Use 0 for the default stack size.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param enmType The thread type. Used for deciding scheduling attributes
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * of the thread.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param fFlags Flags of the RTTHREADFLAGS type (ORed together).
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync * @param pszName Thread name.
14ea49401f3c8c61422aefbda43809e275f60c6cvboxsync VBoxGuestThread(VBoxGuestThreadFunction *pFunction, size_t cbStack, RTTHREADTYPE enmType,
mRunning = false;
mExit = false;
~VBoxGuestThread(void);
int start(void);
bool yield(void);