Prashant Thakre wrote:
Roland Schwarz
writes: What do you expect? You cant simply create threads beyond the system limits, which is roughly 2000 on my box. I tried your code with a really short lived thread: by using function void f() {}. This runs "forever". When running in a debugger, then setting a breakpoint, you will see no threads beyond the main running.
On Solaris 10, this example works just fine. I am just trying to say that behaviour on Windows is different from what one would observe on systems with pthreads, since storage for the *thread* can be reclaimed when that thread terminates(pthread_detach).
There is no detach on Windows, all threads are "detached" by default. There's no join either, you can wait for the thread to end if you like, but this is not required and has no effect on the "storage" for the thread, it's reclaimed either way.