example: Remove manual client adding#107
Conversation
It is not clear what this does, so remove it.
|
Good question. I think you are right both that this code can be removed but also that there should be better documentation here. The event loop is supposed to be an infinite loop that processes events forever as long as an internal reference count I think the unnecessary The code in this example appears to have incorrectly copied the I can think of a number of improvments to make here:
|
|
Thanks for the detailed reply! I'm really enjoying finally getting into the details of this library.
This seems to be broken, i.e. adding diff --git a/example/example.cpp b/example/example.cpp
index ecaabaf..dc996a2 100644
--- a/example/example.cpp
+++ b/example/example.cpp
@@ -57,0 +58 @@ int main(int argc, char** argv)
+ if (eqn == "exit") breakWill result in a
Ah, I was not thinking of these interim periods, that makes sense. How about adding a "listen" boolean to the
I didn't find this that confusing to be honest, and just by looking at the names was assuming "client of the event loop". |
|
Code review ACK 3499810. This code change makes sense, and it definitely doesn't make sense to have an I should follow up with other changes mentioned #107 (comment), especially getting example to shut down cleanly, and it is good to know "client" name is not too confusing. The idea of adding listening bool to constructor to avoid need for an addClient call seems good and could be convenient. I think I'd be reluctant to add a new |
Problem was pointed out by TheCharlatan <seb.kung@gmail.com> in bitcoin-core#107 (comment)
…it cleanly 70b2d87 example: Add missing thread.join() call so example can exit cleanly (Ryan Ofsky) Pull request description: Problem was pointed out by TheCharlatan in #107 (comment) ACKs for top commit: TheCharlatan: ACK 70b2d87 Tree-SHA512: 18a9642ca4579f5299264d1706556c9adff9794b191da24d1d997897fc7e46d4779cebf188453ecc60d671bc7bafca13fc8e756e229623ee983c574d3db0adbd
…nd cmake headers target This update brings in the following changes: bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks bitcoin-core/libmultiprocess#106 Bugfix: Clean up ThreadContext pointers when Connection is destroyed bitcoin-core/libmultiprocess#107 example: Remove manual client adding bitcoin-core/libmultiprocess#108 doc: Add comments for socket descriptor handling when forking bitcoin-core/libmultiprocess#109 example: Add missing thread.join() call so example can exit cleanly bitcoin-core/libmultiprocess#110 cmake: add target_capnp_sources headers target
…nd cmake headers target This update brings in the following changes: bitcoin-core/libmultiprocess#105 types: Add Custom{Build,Read,Pass}Message hooks bitcoin-core/libmultiprocess#106 Bugfix: Clean up ThreadContext pointers when Connection is destroyed bitcoin-core/libmultiprocess#107 example: Remove manual client adding bitcoin-core/libmultiprocess#108 doc: Add comments for socket descriptor handling when forking bitcoin-core/libmultiprocess#109 example: Add missing thread.join() call so example can exit cleanly bitcoin-core/libmultiprocess#110 cmake: add target_capnp_sources headers target
This update brings in the following changes: bitcoin-core/libmultiprocess#107 example: Remove manual client adding bitcoin-core/libmultiprocess#108 doc: Add comments for socket descriptor handling when forking bitcoin-core/libmultiprocess#109 example: Add missing thread.join() call so example can exit cleanly bitcoin-core/libmultiprocess#110 cmake: add target_capnp_sources headers target
This update brings in the following changes: bitcoin-core/libmultiprocess#107 example: Remove manual client adding bitcoin-core/libmultiprocess#108 doc: Add comments for socket descriptor handling when forking bitcoin-core/libmultiprocess#109 example: Add missing thread.join() call so example can exit cleanly bitcoin-core/libmultiprocess#110 cmake: add target_capnp_sources headers target
This update brings in the following changes: bitcoin-core/libmultiprocess#107 example: Remove manual client adding bitcoin-core/libmultiprocess#108 doc: Add comments for socket descriptor handling when forking bitcoin-core/libmultiprocess#109 example: Add missing thread.join() call so example can exit cleanly bitcoin-core/libmultiprocess#110 cmake: add target_capnp_sources headers target
This update brings in the following changes: bitcoin-core/libmultiprocess#107 example: Remove manual client adding bitcoin-core/libmultiprocess#108 doc: Add comments for socket descriptor handling when forking bitcoin-core/libmultiprocess#109 example: Add missing thread.join() call so example can exit cleanly bitcoin-core/libmultiprocess#110 cmake: add target_capnp_sources headers target
This update brings in the following changes: bitcoin-core/libmultiprocess#107 example: Remove manual client adding bitcoin-core/libmultiprocess#108 doc: Add comments for socket descriptor handling when forking bitcoin-core/libmultiprocess#109 example: Add missing thread.join() call so example can exit cleanly bitcoin-core/libmultiprocess#110 cmake: add target_capnp_sources headers target
This update brings in the following changes: bitcoin-core/libmultiprocess#107 example: Remove manual client adding bitcoin-core/libmultiprocess#108 doc: Add comments for socket descriptor handling when forking bitcoin-core/libmultiprocess#109 example: Add missing thread.join() call so example can exit cleanly bitcoin-core/libmultiprocess#110 cmake: add target_capnp_sources headers target
This update brings in the following changes: bitcoin-core/libmultiprocess#107 example: Remove manual client adding bitcoin-core/libmultiprocess#108 doc: Add comments for socket descriptor handling when forking bitcoin-core/libmultiprocess#109 example: Add missing thread.join() call so example can exit cleanly bitcoin-core/libmultiprocess#110 cmake: add target_capnp_sources headers target
This update brings in the following changes: bitcoin-core/libmultiprocess#107 example: Remove manual client adding bitcoin-core/libmultiprocess#108 doc: Add comments for socket descriptor handling when forking bitcoin-core/libmultiprocess#109 example: Add missing thread.join() call so example can exit cleanly bitcoin-core/libmultiprocess#110 cmake: add target_capnp_sources headers target
Opening this more as a question, than a change request, because I am not sure what is going on here, since removing it does not seem to change anything in the program's functionality.
This is probably needed, but it is not clear from the example, or the documentation for what. If it is indeed needed, could the documentation be improved a bit, a comment added to the example or could it alternatively be moved into the
EventLoopconstructor instead? From my understandingaddClientis eventually called internally when a new connection or proxy is created.