fixes for macosx

This commit is contained in:
Guenter Obiltschnig
2008-09-18 18:57:27 +00:00
parent 946018009d
commit 3aa5b996d3
3 changed files with 16 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
//
// File_UNIX.cpp
//
// $Id: //poco/1.3/Foundation/src/File_UNIX.cpp#10 $
// $Id: //poco/1.3/Foundation/src/File_UNIX.cpp#11 $
//
// Library: Foundation
// Package: Filesystem
@@ -209,7 +209,7 @@ Timestamp FileImpl::createdImpl() const
{
poco_assert (!_path.empty());
#if defined(__APPLE__)
#if defined(__APPLE__) && defined(st_birthtime) // st_birthtime is available only on 10.5
struct stat64 st;
if (stat64(_path.c_str(), &st) == 0)
return Timestamp::fromEpochTime(st.st_birthtime);

View File

@@ -1,7 +1,7 @@
//
// Thread_POSIX.cpp
//
// $Id: //poco/1.3/Foundation/src/Thread_POSIX.cpp#5 $
// $Id: //poco/1.3/Foundation/src/Thread_POSIX.cpp#6 $
//
// Library: Foundation
// Package: Threading
@@ -154,9 +154,16 @@ void ThreadImpl::setStackSizeImpl(int size)
#ifndef PTHREAD_STACK_MIN
_pData->stackSize = 0;
#else
if (size != 0 && size < PTHREAD_STACK_MIN)
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;
}
_pData->stackSize = size;
#endif
}

View File

@@ -1,7 +1,7 @@
//
// ThreadTest.cpp
//
// $Id: //poco/1.3/Foundation/testsuite/src/ThreadTest.cpp#4 $
// $Id: //poco/1.3/Foundation/testsuite/src/ThreadTest.cpp#5 $
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
@@ -273,7 +273,7 @@ void ThreadTest::testThreadStackSize()
Thread thread;
assert (0 == thread.getStackSize());
thread.setStackSize(stackSize);
assert (stackSize == thread.getStackSize());
assert (stackSize <= thread.getStackSize());
int tmp = MyRunnable::_staticVar;
thread.start(freeFunc, &tmp);
thread.join();
@@ -284,7 +284,7 @@ void ThreadTest::testThreadStackSize()
#ifdef PTHREAD_STACK_MIN
assert (PTHREAD_STACK_MIN == thread.getStackSize());
#else
assert (stackSize == thread.getStackSize());
assert (stackSize >= thread.getStackSize());
#endif
tmp = MyRunnable::_staticVar;
thread.start(freeFunc, &tmp);