node: Extending processEvents API to allow processing thread management flexibility
The application now can request that the processing thread exists even
if there are no events to process. Face::shutdown need to be called to
terminate thread processing.
Change-Id: I2973d088edbb3765b6f33cb1324055b9dc2c50ec
diff --git a/include/ndn-cpp/face.hpp b/include/ndn-cpp/face.hpp
index 4071501..e006458 100644
--- a/include/ndn-cpp/face.hpp
+++ b/include/ndn-cpp/face.hpp
@@ -161,17 +161,21 @@
* This call will block forever (default timeout == 0) to process IO on the face.
* To exit, one expected to call face.shutdown() from one of the callback methods.
*
- * If timeout is specified, then processEvents will exit after this timeout, if not stopped earlier with face.shutdown().
+ * If positive timeout is specified, then processEvents will exit after this timeout,
+ * if not stopped earlier with face.shutdown() or when all active events finish.
* The call can be called repeatedly, if desired.
*
+ * If negative timeout is specified, then processEvents will not block and process only pending
+ * events.
+ *
* @throw This may throw an exception for reading data or in the callback for processing the data. If you
* call this from an main event loop, you may want to catch and log/disregard all exceptions.
*/
void
- processEvents(Milliseconds timeout = 0)
+ processEvents(Milliseconds timeout = 0, bool keepThread = false)
{
// Just call Node's processEvents.
- node_.processEvents(timeout);
+ node_.processEvents(timeout, keepThread);
}
/**