From David Fries, "I was trying to create a lot of threads under 32 bit Linux, but could

only create 376, then the program would hang.
376 * 8MB stack per thread = 3008 MB
The stack size allocated per thread blew the process address stack.
To get more threads you have to specify a smaller per thread stack,
but while the Thread::start says it will limit the stack size to the
smallest allowable stack size, it won't let it be smaller than the
default.  I included the limits.h header to use PTHREAD_STACK_MIN as
the minimum stack size.

As for the deadlock, if the pthread_create failed, the new thread
doesn't exist and doesn't call threadStartedBlock.release(), so the
existing thread deadlocks on threadStartedBlock.block().  Only block
if the thread was started."
This commit is contained in:
Robert Osfield
2009-11-20 10:27:43 +00:00
parent 65d72d7873
commit f45ae6a4d8
2 changed files with 23 additions and 24 deletions

View File

@@ -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; }