If you create lots of short-lived threads (enough so that they live
and die without invoking the GC) their contexts can fail to be reaped,
causing create-thread% to unnecessarily fail - e.g., invoking
something like (dotimes (i 100) (make-thread (lambda ()))) at the repl
several times will start to die on about the fifth repetition
Here's a patch that tests for that case, calling reap-dead-threads if
create-thread% fails and retrying. If it fails the second time, NIL
is returned to make-thread's caller (and, fixing a secondary bug, 0 is
not pushed onto the session's list of threads).
The perror in os_validate.c is removed because now this particular
mmap failure can be a "normal" thing to occur (though probably a sign
that the thread-creating application could probably benefit from at
least a pooling design). I'm not sure that's the right thing to do,
though, and I only did it in linux-os.c
Get latest updates about Open Source Projects, Conferences and News.