Rename WXTHREAD_XXX_PRIORITY yo wxPRIORITY_XXX.
This will allow to reuse the same constants for the process priorities in an upcoming commit. See #14931. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73405 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3383,5 +3383,13 @@ typedef const void* WXWidget;
|
|||||||
|
|
||||||
#endif /* !wxUSE_NO_MANIFEST && _MSC_FULL_VER >= 140040130 */
|
#endif /* !wxUSE_NO_MANIFEST && _MSC_FULL_VER >= 140040130 */
|
||||||
|
|
||||||
|
/* wxThread and wxProcess priorities */
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
wxPRIORITY_MIN = 0u, /* lowest possible priority */
|
||||||
|
wxPRIORITY_DEFAULT = 50u, /* normal priority */
|
||||||
|
wxPRIORITY_MAX = 100u /* highest possible priority */
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* _WX_DEFS_H_ */
|
/* _WX_DEFS_H_ */
|
||||||
|
@@ -86,12 +86,12 @@ enum wxThreadWait
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// defines the interval of priority
|
// Obsolete synonyms for wxPRIORITY_XXX for backwards compatibility-only
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
WXTHREAD_MIN_PRIORITY = 0u,
|
WXTHREAD_MIN_PRIORITY = wxPRIORITY_MIN,
|
||||||
WXTHREAD_DEFAULT_PRIORITY = 50u,
|
WXTHREAD_DEFAULT_PRIORITY = wxPRIORITY_DEFAULT,
|
||||||
WXTHREAD_MAX_PRIORITY = 100u
|
WXTHREAD_MAX_PRIORITY = wxPRIORITY_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
// There are 2 types of mutexes: normal mutexes and recursive ones. The attempt
|
// There are 2 types of mutexes: normal mutexes and recursive ones. The attempt
|
||||||
@@ -558,7 +558,8 @@ public:
|
|||||||
wxThreadError Resume();
|
wxThreadError Resume();
|
||||||
|
|
||||||
// priority
|
// priority
|
||||||
// Sets the priority to "prio": see WXTHREAD_XXX_PRIORITY constants
|
// Sets the priority to "prio" which must be in 0..100 range (see
|
||||||
|
// also wxPRIORITY_XXX constants).
|
||||||
//
|
//
|
||||||
// NB: the priority can only be set before the thread is created
|
// NB: the priority can only be set before the thread is created
|
||||||
void SetPriority(unsigned int prio);
|
void SetPriority(unsigned int prio);
|
||||||
|
@@ -675,17 +675,6 @@ enum wxThreadError
|
|||||||
wxTHREAD_MISC_ERROR
|
wxTHREAD_MISC_ERROR
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
Defines the interval of priority
|
|
||||||
*/
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
WXTHREAD_MIN_PRIORITY = 0u,
|
|
||||||
WXTHREAD_DEFAULT_PRIORITY = 50u,
|
|
||||||
WXTHREAD_MAX_PRIORITY = 100u
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@class wxThread
|
@class wxThread
|
||||||
|
|
||||||
@@ -1113,12 +1102,9 @@ public:
|
|||||||
static wxThreadIdType GetMainId();
|
static wxThreadIdType GetMainId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gets the priority of the thread, between zero and 100.
|
Gets the priority of the thread, between 0 (lowest) and 100 (highest).
|
||||||
|
|
||||||
The following priorities are defined:
|
@see SetPriority()
|
||||||
- @b WXTHREAD_MIN_PRIORITY: 0
|
|
||||||
- @b WXTHREAD_DEFAULT_PRIORITY: 50
|
|
||||||
- @b WXTHREAD_MAX_PRIORITY: 100
|
|
||||||
*/
|
*/
|
||||||
unsigned int GetPriority() const;
|
unsigned int GetPriority() const;
|
||||||
|
|
||||||
@@ -1234,13 +1220,15 @@ public:
|
|||||||
static bool SetConcurrency(size_t level);
|
static bool SetConcurrency(size_t level);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the priority of the thread, between 0 and 100.
|
Sets the priority of the thread, between 0 (lowest) and 100 (highest).
|
||||||
|
|
||||||
It can only be set after calling Create() but before calling Run().
|
It can only be set after calling Create() but before calling Run().
|
||||||
|
|
||||||
The following priorities are defined:
|
The following symbolic constants can be used in addition to raw
|
||||||
- @b WXTHREAD_MIN_PRIORITY: 0
|
values in 0..100 range:
|
||||||
- @b WXTHREAD_DEFAULT_PRIORITY: 50
|
- ::wxPRIORITY_MIN: 0
|
||||||
- @b WXTHREAD_MAX_PRIORITY: 100
|
- ::wxPRIORITY_DEFAULT: 50
|
||||||
|
- ::wxPRIORITY_MAX: 100
|
||||||
*/
|
*/
|
||||||
void SetPriority(unsigned int priority);
|
void SetPriority(unsigned int priority);
|
||||||
|
|
||||||
|
@@ -559,11 +559,11 @@ void MyFrame::OnStartThreads(wxCommandEvent& WXUNUSED(event) )
|
|||||||
// have the lowest priority, the second - the highest, all the rest
|
// have the lowest priority, the second - the highest, all the rest
|
||||||
// the normal one
|
// the normal one
|
||||||
if ( n == 0 )
|
if ( n == 0 )
|
||||||
thr->SetPriority(WXTHREAD_MIN_PRIORITY);
|
thr->SetPriority(wxPRIORITY_MIN);
|
||||||
else if ( n == 1 )
|
else if ( n == 1 )
|
||||||
thr->SetPriority(WXTHREAD_MAX_PRIORITY);
|
thr->SetPriority(wxPRIORITY_MAX);
|
||||||
else
|
else
|
||||||
thr->SetPriority(WXTHREAD_DEFAULT_PRIORITY);
|
thr->SetPriority(wxPRIORITY_DEFAULT);
|
||||||
|
|
||||||
threads.Add(thr);
|
threads.Add(thr);
|
||||||
}
|
}
|
||||||
|
@@ -442,7 +442,7 @@ public:
|
|||||||
m_thread = thread;
|
m_thread = thread;
|
||||||
m_hThread = 0;
|
m_hThread = 0;
|
||||||
m_state = STATE_NEW;
|
m_state = STATE_NEW;
|
||||||
m_priority = WXTHREAD_DEFAULT_PRIORITY;
|
m_priority = wxPRIORITY_DEFAULT;
|
||||||
m_nRef = 1;
|
m_nRef = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -699,7 +699,7 @@ bool wxThreadInternal::Create(wxThread *thread, unsigned int stackSize)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_priority != WXTHREAD_DEFAULT_PRIORITY )
|
if ( m_priority != wxPRIORITY_DEFAULT )
|
||||||
{
|
{
|
||||||
SetPriority(m_priority);
|
SetPriority(m_priority);
|
||||||
}
|
}
|
||||||
|
@@ -354,7 +354,7 @@ public:
|
|||||||
{
|
{
|
||||||
m_hThread = 0;
|
m_hThread = 0;
|
||||||
m_eState = STATE_NEW;
|
m_eState = STATE_NEW;
|
||||||
m_nPriority = WXTHREAD_DEFAULT_PRIORITY;
|
m_nPriority = wxPRIORITY_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
~wxThreadInternal()
|
~wxThreadInternal()
|
||||||
@@ -497,7 +497,7 @@ bool wxThreadInternal::Create( wxThread* pThread,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_hThread = tid;
|
m_hThread = tid;
|
||||||
if (m_nPriority != WXTHREAD_DEFAULT_PRIORITY)
|
if (m_nPriority != wxPRIORITY_DEFAULT)
|
||||||
{
|
{
|
||||||
SetPriority(m_nPriority);
|
SetPriority(m_nPriority);
|
||||||
}
|
}
|
||||||
|
@@ -475,7 +475,7 @@ public:
|
|||||||
{
|
{
|
||||||
m_tid = kInvalidID;
|
m_tid = kInvalidID;
|
||||||
m_state = STATE_NEW;
|
m_state = STATE_NEW;
|
||||||
m_prio = WXTHREAD_DEFAULT_PRIORITY;
|
m_prio = wxPRIORITY_DEFAULT;
|
||||||
m_notifyQueueId = kInvalidID;
|
m_notifyQueueId = kInvalidID;
|
||||||
m_exitcode = 0;
|
m_exitcode = 0;
|
||||||
m_cancelled = false ;
|
m_cancelled = false ;
|
||||||
@@ -683,7 +683,7 @@ bool wxThreadInternal::Create( wxThread *thread, unsigned int stackSize )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_prio != WXTHREAD_DEFAULT_PRIORITY )
|
if ( m_prio != wxPRIORITY_DEFAULT )
|
||||||
SetPriority( m_prio );
|
SetPriority( m_prio );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -1110,8 +1110,7 @@ bool wxThread::TestDestroy()
|
|||||||
|
|
||||||
void wxThread::SetPriority(unsigned int prio)
|
void wxThread::SetPriority(unsigned int prio)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( ((int)WXTHREAD_MIN_PRIORITY <= (int)prio) &&
|
wxCHECK_RET( wxPRIORITY_MIN <= prio && prio <= wxPRIORITY_MAX,
|
||||||
((int)prio <= (int)WXTHREAD_MAX_PRIORITY),
|
|
||||||
wxT("invalid thread priority") );
|
wxT("invalid thread priority") );
|
||||||
|
|
||||||
wxCriticalSectionLocker lock(m_critsect);
|
wxCriticalSectionLocker lock(m_critsect);
|
||||||
|
@@ -954,7 +954,7 @@ wxThreadInternal::wxThreadInternal()
|
|||||||
{
|
{
|
||||||
m_state = STATE_NEW;
|
m_state = STATE_NEW;
|
||||||
m_cancelled = false;
|
m_cancelled = false;
|
||||||
m_prio = WXTHREAD_DEFAULT_PRIORITY;
|
m_prio = wxPRIORITY_DEFAULT;
|
||||||
m_threadId = 0;
|
m_threadId = 0;
|
||||||
m_exitcode = 0;
|
m_exitcode = 0;
|
||||||
|
|
||||||
@@ -1231,7 +1231,7 @@ wxThreadError wxThread::Create(unsigned int WXUNUSED_STACKSIZE(stackSize))
|
|||||||
}
|
}
|
||||||
else if ( max_prio == min_prio )
|
else if ( max_prio == min_prio )
|
||||||
{
|
{
|
||||||
if ( prio != WXTHREAD_DEFAULT_PRIORITY )
|
if ( prio != wxPRIORITY_DEFAULT )
|
||||||
{
|
{
|
||||||
// notify the programmer that this doesn't work here
|
// notify the programmer that this doesn't work here
|
||||||
wxLogWarning(_("Thread priority setting is ignored."));
|
wxLogWarning(_("Thread priority setting is ignored."));
|
||||||
@@ -1320,8 +1320,7 @@ wxThreadError wxThread::Run()
|
|||||||
|
|
||||||
void wxThread::SetPriority(unsigned int prio)
|
void wxThread::SetPriority(unsigned int prio)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( ((int)WXTHREAD_MIN_PRIORITY <= (int)prio) &&
|
wxCHECK_RET( wxPRIORITY_MIN <= prio && prio <= wxPRIORITY_MAX,
|
||||||
((int)prio <= (int)WXTHREAD_MAX_PRIORITY),
|
|
||||||
wxT("invalid thread priority") );
|
wxT("invalid thread priority") );
|
||||||
|
|
||||||
wxCriticalSectionLocker lock(m_critsect);
|
wxCriticalSectionLocker lock(m_critsect);
|
||||||
@@ -1347,8 +1346,7 @@ void wxThread::SetPriority(unsigned int prio)
|
|||||||
//
|
//
|
||||||
// FIXME this is not true for 2.6!!
|
// FIXME this is not true for 2.6!!
|
||||||
|
|
||||||
// map wx priorites WXTHREAD_MIN_PRIORITY..WXTHREAD_MAX_PRIORITY
|
// map wx priorites 0..100 to Unix priorities 20..-20
|
||||||
// to Unix priorities 20..-20
|
|
||||||
if ( setpriority(PRIO_PROCESS, 0, -(2*(int)prio)/5 + 20) == -1 )
|
if ( setpriority(PRIO_PROCESS, 0, -(2*(int)prio)/5 + 20) == -1 )
|
||||||
{
|
{
|
||||||
wxLogError(_("Failed to set thread priority %d."), prio);
|
wxLogError(_("Failed to set thread priority %d."), prio);
|
||||||
|
@@ -257,8 +257,8 @@ void MiscThreadTestCase::TestDetached()
|
|||||||
threads[n] = new MyDetachedThread(10, 'A' + n);
|
threads[n] = new MyDetachedThread(10, 'A' + n);
|
||||||
}
|
}
|
||||||
|
|
||||||
threads[0]->SetPriority(WXTHREAD_MIN_PRIORITY);
|
threads[0]->SetPriority(wxPRIORITY_MIN);
|
||||||
threads[1]->SetPriority(WXTHREAD_MAX_PRIORITY);
|
threads[1]->SetPriority(wxPRIORITY_MAX);
|
||||||
|
|
||||||
for ( n = 0; n < nThreads; n++ )
|
for ( n = 0; n < nThreads; n++ )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user