Event loops: started once when services' first clients come at once

loopsstart() runs on the thread of the service whose client is the first
one to be served on a loop, not on the configuration's thread: two
services given their first clients at the same time could each initialize
its mutex, take it, and start loops of their own. A loop of the second
array was then given to a thread of the first one as well: two threads
ran one loop, and its timers and fibers were taken by both (crashes in
the timers' heap, seen on Windows under load).

The mutex is a global one now, made at startup with the others.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vladimir DubrovinandClaude Opus 5.5 committed 2026-10-27 14:40:30 +03:00
1 parent 97ab683654
commit 63cfcafbc5
4 files changed
+12 -13

No files matched your search

+1
View File
@@ -491,6 +491,7 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int
_3proxy_mutex_init(&bandlim_mutex);
_3proxy_mutex_init(&connlim_mutex);
_3proxy_mutex_init(&tc_mutex);
_3proxy_mutex_init(&loops_mutex);
_3proxy_mutex_init(&tpool.mutex);
#ifndef NORADIUS
_3proxy_mutex_init(&rad_mutex);