[Lazarus] OSX: Semaphore init failed despite using cthreads and destroying threads.

Martin Grajcar maaartinus at gmail.com
Fri Aug 12 22:56:09 CEST 2016


Our application starts a few hundreds threads (one per HTTP request), but
it does so in a way ensuring that at any time, there are never more than a
few (e.g., 3) of them. We are using cthreads and I could verify that
Destroy gets called (most probably via FreeOnTerminate). The pattern looks
like

Create
Create
Create
Destroy
Create
Destroy
Create
Destroy
...

The debugger shows only a couple Threads at any time, which looks fine, too.

The application runs on Linux without any problems, but on OS X, it crashes
when creating the 180th thread or about with the message

"Semaphore init failed (possibly too many concurrent threads)"

Any idea what may be going wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160812/951072a2/attachment.html>


More information about the Lazarus mailing list