Bitcoin full node and query server

Apr 8, 2021

View in context in the libbitcoin Slack #general mirror.

P
Phil20:07
Eric: In my application are two groups of threads: (1) ‘My’ threads. This is the main thread created by the OS, and all the other threads I personally pthread_create():d in my logics. None of these threads are included in LB’s “threadpool_“. (2) LibBitcoin worker threads. All of these are in LB’s “threadpool”_“. Please confirm that in your view and to confirm what you are saying is, the treadpool::join call can be made from ANY of the group (1) OS threads, however from NONE of the (2) OS threads as if I’d do threadpool::join() in any of the group (2) threads of course I would get the termination problem that you mention, which would be that threadpool:join() would wait for all threadpool threads to terminate, and the caller would be one of those threads that are being waited for to terminate, alas a deadlock. Please confirm to me that this is the whole picture and there is no more complexity in LibBitcoin or to your knowledge in Boost in respect of requirement for which thread to invoke full_node::close() from. So this is also the full meaning of the comment // This must be called from the thread that constructed this class (see join). bool full_node::close() https://github.com/libbitcoin/libbitcoin-node/blob/master/src/full_node.cpp#L358 Soo, did I get it right? :) May I then suggest rewording that comment, just as it took me a week now to clarify that it actually meant what I thought it meant Something like // This must be called from the thread that constructed this class (see join). // (Specifically, this must be called from a thread that is not one of LibBitcoin’s worker threads, that is any thread created by LibBitcoin. These are contained in the threadpool_ set.)