I connect to database in thread. Standard threads <thread>. I am waiting for termination : thread.join().
But sometimes I must wait infinitely. How to terminate?
In main thread sleep and after delete threads? How to reconcile with join?
I can't use join or condition variable because in thread I have database operation which hangs thread.
Join is never reached.
delete thread is enough to close thread by system (for example Linux)?
For example:
in thread : connect to Neo4j database - wait and wait...
main thread know it exceeds timeout, but if mainthread calls delete thread it terminate main thread!