On 22 May 2009, at 17:03, Luca Olivetti wrote:
While I was testing an unrelated issue, I discovered this: under
windows, with fpc 2.2.4, I try to start 10000 thread (I know it's
absurd
but it's just a test) and have all of them linger around for 10
seconds.
The thread actually started are 121. The problem is that no
exception is
raised, so how can I be sure that a thread is really started in a more
normal scenario?
You can obtain the "handle" property of the tthread instance and check
it against whatever "invalid handle" CreateThread returns under
Windows when it fails (although that will obviously not be portable).
Is there a hard limit on the number of threads under
windows?
I'm pretty sure there is one for every OS.
If so, why no exception when I try to create more?
Because the Windows version of tthread.create does not check for any
errors. You can submit a bug report about this.
If I run the same program under Linux, an "EThread: failed to create
new
thread" exception is raised after around 300 threads.
The unix version does check for errors.
Jonas
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal