diff --git a/include/osgDB/Output b/include/osgDB/Output index 1efedcdb7..24264c96e 100644 --- a/include/osgDB/Output +++ b/include/osgDB/Output @@ -91,9 +91,11 @@ class OSGDB_EXPORT Output : public osgDB::ofstream virtual std::string getFileNameForOutput(const std::string& filename) const; const std::string& getFileName() const { return _filename; } + // Set and get if export texture files during write void setOutputTextureFiles(bool flag) { _outputTextureFiles = flag; } bool getOutputTextureFiles() const { return _outputTextureFiles; } + // support code for OutputTextureFiles virtual std::string getTextureFileNameForOutput(); void setOutputShaderFiles(bool flag) { _outputShaderFiles = flag; } diff --git a/src/OpenThreads/pthreads/PThread.c++ b/src/OpenThreads/pthreads/PThread.c++ index db0b864b5..0f46a138d 100644 --- a/src/OpenThreads/pthreads/PThread.c++ +++ b/src/OpenThreads/pthreads/PThread.c++ @@ -21,6 +21,7 @@ #include #include #include +#include #if defined __linux || defined __sun || defined __APPLE__ #include @@ -588,29 +589,28 @@ int Thread::start() { PThreadPrivateData *pd = static_cast (_prvData); - size_t defaultStackSize; - pthread_attr_getstacksize( &thread_attr, &defaultStackSize); - if(status != 0) { - return status; - } - - if(defaultStackSize < pd->stackSize) { - - pthread_attr_setstacksize( &thread_attr, pd->stackSize); - if(status != 0) { - return status; - } + //------------------------------------------------------------------------- + // Set the stack size if requested, but not less than a platform reasonable + // value. + // + if(pd->stackSize) { + if(pd->stackSize < PTHREAD_STACK_MIN) + pd->stackSize = PTHREAD_STACK_MIN; + pthread_attr_setstacksize( &thread_attr, pd->stackSize); + if(status != 0) { + return status; + } } //------------------------------------------------------------------------- // Now get what we actually have... // - pthread_attr_getstacksize( &thread_attr, &defaultStackSize); + size_t size; + pthread_attr_getstacksize( &thread_attr, &size); if(status != 0) { return status; } - - pd->stackSize = defaultStackSize; + pd->stackSize = size; //------------------------------------------------------------------------- // Prohibit the stack size from being changed. @@ -635,18 +635,15 @@ int Thread::start() { status = pthread_create(&(pd->tid), &thread_attr, ThreadPrivateActions::StartThread, static_cast(this)); - - // wait till the thread has actually started. - pd->threadStartedBlock.block(); - if(status != 0) { - return status; + if(status == 0) { + // wait till the thread has actually started. + pd->threadStartedBlock.block(); + + pd->idSet = true; } - pd->idSet = true; - - return 0; - + return status; } //-----------------------------------------------------------------------------