Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-08

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

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin Grajcar

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>

Reply by email