Catching thread creation error
tcak via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Apr 4 13:35:36 PDT 2016
On Monday, 4 April 2016 at 20:28:13 UTC, tcak wrote:
> In my server program, when a request comes, I create a new
> thread for that.
>
> I put memory limit to program with setrlimit. So, when the
> limit is reached, new thread cannot be created.
>
> I want to tell client back that there is system problem. But
> catching "Throwable" does not suffice for this it seems like.
> Program still breaks and tells that "Error creating thread". Is
> there any normal way to catch this event?
Okay. That's my mistake. I was looking at "new Thread" part
instead of "start". The "start" function is what allocates memory
for the new thread. So, it is the one where try-catch should be
used.
More information about the Digitalmars-d-learn
mailing list