Open gedaiu opened 4 years ago
vibe core creates the threads even if I do this in my main function:
int main() {
setupWorkerThreads(0);
On Posix, there will be a thread pool for file I/O operations and using most functions in vibe.core.file
will also spawn separate I/O worker threads (nowadays). Getting by without any threads is unfortunately difficult (requiring low-level hacks) or outright impossible for certain asynchronous operations.
However, as long as threads in general work, the amount of threads created/used should be constant, unless I'm forgetting something. So the call stack that seems to imply that TaskFiber.run()
might be responsible for creating a new thread is definitely not complete.
If this was still a current issue, I would probably try to set a breakpoint at pthread_create
to see where the threads are actually created from.
For the record, eventcore creates 4 threads for its I/O and the separate pool in vibe-core has 3 additional threads. So with setupWorkerThreads(1)
that should result in 8 worker threads in total. Note that setupWorkerThreads(0)
will actually result in logicalProcessorCount
to be used as the number of worker threads.
I get an
Core.thread.osthread.ThreadError@src/core/thread/osthread.d(3176): Error creating thread
when I run a task intensive app. Does anyone know how I could debug this?