thread fixes for macosx

This commit is contained in:
Guenter Obiltschnig
2008-09-18 19:07:15 +00:00
parent 5f605414ff
commit 868390ad58

View File

@@ -1,7 +1,7 @@
// //
// Thread_POSIX.cpp // Thread_POSIX.cpp
// //
// $Id: //poco/svn/Foundation/src/Thread_POSIX.cpp#2 $ // $Id: //poco/1.3/Foundation/src/Thread_POSIX.cpp#6 $
// //
// Library: Foundation // Library: Foundation
// Package: Threading // Package: Threading
@@ -156,11 +156,18 @@ void ThreadImpl::setStackSizeImpl(int size)
#ifndef PTHREAD_STACK_MIN #ifndef PTHREAD_STACK_MIN
_pData->stackSize = 0; _pData->stackSize = 0;
#else #else
if (size !=0 && size < PTHREAD_STACK_MIN) if (size != 0)
{
#if defined(__APPLE__)
// we must round up to a multiple of the memory page size
const int PAGE_SIZE = 4096;
size = ((size + PAGE_SIZE - 1)/PAGE_SIZE)*PAGE_SIZE;
#endif
if (size < PTHREAD_STACK_MIN)
size = PTHREAD_STACK_MIN; size = PTHREAD_STACK_MIN;
}
_pData->stackSize = size; _pData->stackSize = size;
#endif // PTHREAD_STACK_MIN #endif
} }
@@ -343,13 +350,8 @@ void* ThreadImpl::callableEntry(void* pThread)
int ThreadImpl::mapPrio(int prio) int ThreadImpl::mapPrio(int prio)
{ {
#if defined(__VMS) || defined(__digital__) int pmin = getMinOSPriorityImpl();
static const int pmin = PRI_OTHER_MIN; int pmax = getMaxOSPriorityImpl();
static const int pmax = PRI_OTHER_MAX;
#else
static const int pmin = sched_get_priority_min(SCHED_OTHER);
static const int pmax = sched_get_priority_max(SCHED_OTHER);
#endif
switch (prio) switch (prio)
{ {