Jump to content
  • Advertisement
Sign in to follow this  
Conn

Threads

This topic is 4235 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I working on a app that contains a number of threads, and i have encountered a problem with starting threads. Im using pthread btw. For some reason im only allowed to start 15 threads all together. Im able to start all the threads if i rearrange the order of them but only 15 at one time. Anyone know if theres a limitation in the system or the compiler. Im using Visual Studio 2005 Professional Edition.

Share this post


Link to post
Share on other sites
Advertisement
What happens when you try to start the 16th thread? Does it crash, or does it return an error? If it returns an error, what error code is it?

Share this post


Link to post
Share on other sites
error code 11 = EAGAIN.

from the manpage of pthread_create (I'm using it on linux, though):
This function may return the following errors:
`EAGAIN'
Not enough system resources to create a process for the new
thread, or more than `PTHREAD_THREADS_MAX' threads are
already active.


So, either you have PTHREAD_THREADS_MAX = 15 or you don't have enough system resources to create thread number 16.

You can try setting a smaller stack for the threads via pthread_attr_setstacksize() and if you can create more than 15 threads at a time, then your problem is resources, not PTHREAD_THREADS_MAX.

Share this post


Link to post
Share on other sites
I suspect that the problem is PTHREAD_THREADS_MAX rather than the amount of free system resources. 15 threads, plus your main thread is 16, which seems like a sensible number for PTHREAD_THREADS_MAX. Also, I have Outlook running at the moment with 19 threads (On Windows) without any problems.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!