mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00
![]() This adds support for multithreaded service to lws without adding any threading or locking code in the library. At context creation time you can request split the service part of the context into n service domains, which are load-balanced so that the most idle one gets the next listen socket accept. There's a single listen socket on one port still. User code may then spawn n threads doing n service loops / poll()s simultaneously. Locking is only required (I think) in the existing FD lock callbacks already handled by the pthreads server example, and that locking takes place in user code. So the library remains completely agnostic about the threading / locking scheme. And by default, it's completely compatible with one service thread so no changes are required by people uninterested in multithreaded service. However for people interested in extremely lightweight mass http[s]/ ws[s] service with minimum provisioning, the library can now do everything out of the box. To test it, just try $ libwebsockets-test-server-pthreads -j 8 where -j controls the number of service threads Signed-off-by: Andy Green <andy.green@linaro.org> |
||
---|---|---|
.. | ||
.gitignore | ||
attack.sh | ||
favicon.ico | ||
fuzxy.c | ||
leaf.jpg | ||
libwebsockets.org-logo.png | ||
test-client.c | ||
test-echo.c | ||
test-fraggle.c | ||
test-ping.c | ||
test-server-dumb-increment.c | ||
test-server-echogen.c | ||
test-server-http.c | ||
test-server-libev.c | ||
test-server-mirror.c | ||
test-server-pthreads.c | ||
test-server.c | ||
test-server.h | ||
test.html |