I have an API that returns handles to background processes. These handles themselves have some threads as instance variables. I want to avoid forcing the user to call an explicit cleanup method to call .join on the threads. The threads themselves will finish their work sooner or later. Here are my questions:
- What happens if there are no remaining references in the program to my object? Will it get garbage collected as usual? Do the threads get stopped in some way?
- What happens if I don't call
.joinon a thread, but it finishes its work? Does it get garbage collected and totally cleaned up as I'd called.joinanyways?