From 58f214ea0c9dee71378bfe4f4abaf784724c2a0c Mon Sep 17 00:00:00 2001
From: Andy Green <andy.green@linaro.org>
Date: Sat, 9 Mar 2013 13:03:53 +0800
Subject: [PATCH] document revent clearing scheme

Signed-off-by: Andy Green <andy.green@linaro.org>
---
 README.coding | 7 +++++++
 changelog     | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/README.coding b/README.coding
index 0231d030..d26c21db 100644
--- a/README.coding
+++ b/README.coding
@@ -156,6 +156,13 @@ LWS_CALLBACK_SET_MODE_POLL_FD and LWS_CALLBACK_CLEAR_MODE_POLL_FD
 appear in the callback for protocol 0 and allow interface code to
 manage socket descriptors in other poll loops.
 
+You can pass all pollfds that need service to libwebsocket_service_fd(), even
+if the socket or file does not belong to libwebsockets it is safe.
+
+If libwebsocket handled it, it zeros the pollfd revents field before returning.
+So you can let libwebsockets try and if pollfd->revents is nonzero on return,
+you know it needs handling by your code.
+
 
 Using with in c++ apps
 ----------------------
diff --git a/changelog b/changelog
index f0278dc9..985d71bd 100644
--- a/changelog
+++ b/changelog
@@ -14,6 +14,12 @@ User api additions
  	added, replacing CIPHERS_LIST_STRING.  NULL means use the ssl library
 	default list of ciphers.
 
+ - Not really an api addition, but libwebsocket_service_fd() will now zero
+ 	the revents field of the pollfd it was called with if it handled the
+	descriptor.  So you can tell if it is a non-lws fd by checking revents
+	after the service call... if it's still nonzero, the descriptor
+	belongs to you and you need to take care of it.
+
 User api changes
 ----------------
 
-- 
GitLab