Class CWin32Thread::
SetPriority()
Base ClassesData ItemsConstructorsDestructorsFunctionsCustom CodeGo to hierarchy chart    Prev page: operator =Next page: Start    Show member index
Public Function Declared in:
Win32Thread.h

'Declaration' icon -- Shortcut to top of page. Declaration

virtual BOOL SetPriority(
    CGenericThread::ThreadPriority aPriority);

'Description' icon -- Shortcut to top of page. Description

Set the thread priority (must be set before Start)

'Function Body' icon -- Shortcut to top of page. Function Body

try
{
    static const int iThreadPriority[]={THREAD_PRIORITY_IDLE,
                                        THREAD_PRIORITY_LOWEST,
                                        THREAD_PRIORITY_BELOW_NORMAL,
                                        THREAD_PRIORITY_NORMAL,
                                        THREAD_PRIORITY_ABOVE_NORMAL,
                                        THREAD_PRIORITY_HIGHEST,
                                        THREAD_PRIORITY_TIME_CRITICAL};

    //Do we have a thread
    if (GetThreadStatus()==tsStopped)
    {
        //Recreate the thread
        //Create the thread in suspend mode
        m_hThread=CreateThread(NULL,
                               0,
                               Win32Thread,
                               this,
                               CREATE_SUSPENDED,
                               &m_dwThreadID);

        //Check if created
        if (m_hThread)
            SetThreadStatus(tsSuspended);
        else
            //Can't run
            return FALSE;
    }

    //Now we can set the priority
    return SetThreadPriority(m_hThread,iThreadPriority[aPriority]);
}
ERROR_HANDLER_RETURN("SetPriority",FALSE)

'See Also' icon -- Shortcut to top of page. See Also

Class Overview Class Overview  |  Public base class CGenericThread  |  Hierarchy Chart Hierarchy Chart


Get Surveyor!This web site was generated using Surveyor V4.50.811.1.  Click here for more information. Site content copyright © 2003 Komodia LTD.. See the About page for additional notices. This page last updated: 24 Feb 2003.