Skip to content
Snippets Groups Projects
Commit caaf26c7 authored by Andy Green's avatar Andy Green
Browse files

libuv: foreign loop detach doesn not require lws running the loop at all

This completely removes the loop self-running stuff.

Static allocations (uv_idle, timers etc) are referenced-counted in the context
same as the wsi are.  When lws wants to close, he first closes all his wsi, then
when that is completed in the uv close callbacks, he closes all of his static
uv handles.  When that is also completed in the uv callbacks, he stops the loop
so the lws context can destroy and exit.

Any direct libuv allocations in protocol handlers must participate in the
reference counting.  Two new apis are provided

 - lws_libuv_static_refcount_add(handle, context) to mark the handle with
   a pointer to the context and increment the global uv object counter

 - lws_libuv_static_refcount_del() which should be used as the close callback
   for your own libuv objects declared in the protocol scope.
parent 7d466ba9
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment