add locking callback for fds
authorAndy Green <andy.green@linaro.org>
Wed, 18 Dec 2013 01:48:26 +0000 (09:48 +0800)
committerAndy Green <andy.green@linaro.org>
Wed, 18 Dec 2013 01:48:26 +0000 (09:48 +0800)
commit7a1327977ac10bdbace0012274b8ae889219880e
treeca58a476714ab2298af88fb5ee4a02e7a8d0e8d3
parent5b34c975aee5a15e382bdfbd3d5110e4101a0879
add locking callback for fds

This adds two new callbacks in protocols[0] that are optional for allowing limited thread
access to libwebsockets, LWS_CALLBACK_LOCK_POLL and LWS_CALLBACK_UNLOCK_POLL.

If you use them, they protect internal and external poll list changes, but if you want to use
external thread access to libwebsocket_callback_on_writable() you have to implement your
locking here even if you don't use external poll support.

If you will use another thread for this, take a lot of care about managing your list of
live wsi by doing it from ESTABLISHED and CLOSED callbacks (with your own locking).

Signed-off-by: Andy Green <andy.green@linaro.org>
changelog
lib/client.c
lib/libwebsockets.c
lib/libwebsockets.h
lib/server.c
test-server/test-server.c