Event loops: served on by default, the data relayed by the loops

loopmode is cb unless a configuration says otherwise, as -L2 had it
for a service: its clients on event loops, a connection's data relayed
by the loop itself where nothing but the sockets is between its sides.
A service whose clients cannot share a thread (threadperclient: PAM,
LDAP, FilePlugin, names resolved by the system, -ne) or listening for
connections back (-R) still gives each a thread, as do the standalone
services and builds without fibers. loopmode on and -L keep the loops
with the relay on the client's stack; loopmode off and -L0 a thread
for each client.

The man page tells of cb. tests/run.py --loopmode takes the mode
(cb, on, off) to give every configuration, with two loops; the Linux
workflow runs the suite once more with a thread for each client, which
is no longer what a configuration gets by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vladimir DubrovinandClaude Opus 5.5 committed 2026-10-28 11:49:51 +03:00
1 parent 143158e97f
commit 023eb8f830
8 files changed
+33 -18

No files matched your search

+1 -1
View File
@@ -429,7 +429,7 @@ static int h_loops(int argc, unsigned char **argv){
static int h_loopmode(int argc, unsigned char **argv){
if(!strcmp((char *)argv[1], "on")) conf->loopmode = 1;
else if(!strcmp((char *)argv[1], "off")) conf->loopmode = 0;
/* and their data relayed by the loop (a draft) */
/* and their data relayed by the loop: the default */
else if(!strcmp((char *)argv[1], "cb")) conf->loopmode = 2;
else return 1;
return 0;
+2
View File
@@ -22,6 +22,8 @@
.trafcounter = NULL,
.services = NULL,
.stacksize = 0,
/* clients served on event loops, their data relayed by the loops */
.loopmode = 2,
.poolmax = DEFAULT_POOLMAX,
.pooltimeout = DEFAULT_POOLTIMEOUT,
.counterd = -1,
+1 -1
View File
@@ -480,7 +480,7 @@ static int srvprepare(struct srvstart *s, int argc, char **argv){
srv->stacksize = atoi(argv[i]+2);
break;
case 'L':
/* -L2: and their data relayed by the loop (a draft) */
/* -L2: and their data relayed by the loop (the default) */
srv->loopmode = argv[i][2]? atoi(argv[i]+2) : 1;
break;
case 'a':
+6 -5
View File
@@ -7,9 +7,10 @@
*/
/* Clients served on event loops: a few threads, a CPU each by default
(loops), each running a loop, and each client of a service given -L (or
loopmode on) served by a fiber of one of them, with the same code as a
client with a thread of its own: its waits in sockpoll() wait in the loop.
(loops), each running a loop, and each client of a service (unless given
-L0 or loopmode off) served by a fiber of one of them, with the same code
as a client with a thread of its own: its waits in sockpoll() wait in the
loop.
A service whose clients cannot share a thread (threadperclient), one
listening for connections back (-R), all of its clients waiting for the
same socket, which a loop waits for once, or a build or processor without
@@ -426,13 +427,13 @@ DONE:
}
/* ---- sockmap() as callbacks (-L2, a draft) ------------------------------- */
/* ---- sockmap() as callbacks (-L2, loopmode cb) --------------------------- */
/* The data of a connection mapped by a fiber of a loop with neither filters,
limits but that of a body's length, nor anything but the socket functions of the system between the
sides, is relayed by the loop itself: the sockets call it back, on the
loop's own stack, and the fiber, parked meanwhile, is resumed only once
the mapping is over. No splice() yet: data is copied. */
the mapping is over. */
/* rounds of a read and a write each way at most in a callback, before what
is still ready waits for the next turn of the loop */
+2 -1
View File
@@ -1009,7 +1009,8 @@ struct extparam {
int filtermaxsize;
int poolmax, pooltimeout; /* threadpool: idle workers kept, -1 automatic */
int loops; /* threads serving clients on event loops, 0: a CPU each */
int loopmode; /* services from here on serve clients on loops */
int loopmode; /* services from here on serve clients on loops: 1, and
relay their data there: 2 */
int gracetraf, gracenum, gracedelay;
int maxseg;
unsigned char **archiver;