Use pthread_setconcurrency() in wxThread::SetConcurrency().
Use POSIX function if available instead of only using Solaris-specific thr_setconcurrency() which is not found in modern Linux systems any more. Closes #2115. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70960 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1127,18 +1127,23 @@ wxThreadIdType wxThread::GetCurrentId()
|
||||
|
||||
bool wxThread::SetConcurrency(size_t level)
|
||||
{
|
||||
#ifdef HAVE_THR_SETCONCURRENCY
|
||||
#ifdef HAVE_PTHREAD_SET_CONCURRENCY
|
||||
int rc = pthread_setconcurrency( level );
|
||||
#elif defined(HAVE_THR_SETCONCURRENCY)
|
||||
int rc = thr_setconcurrency(level);
|
||||
if ( rc != 0 )
|
||||
{
|
||||
wxLogSysError(rc, wxT("thr_setconcurrency() failed"));
|
||||
}
|
||||
|
||||
return rc == 0;
|
||||
#else // !HAVE_THR_SETCONCURRENCY
|
||||
// ok only for the default value
|
||||
return level == 0;
|
||||
int rc = level == 0 ? 0 : -1;
|
||||
#endif // HAVE_THR_SETCONCURRENCY/!HAVE_THR_SETCONCURRENCY
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
wxLogSysError(rc, _("Failed to set thread concurrency level to %lu"),
|
||||
static_cast<unsigned long>(level));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user