// we don't need to close wordlist_file
// it will be closed when the variable goes out of scope
AND// mutex is released here as _guard is dropped
That's a fancy name for good old garbage collector from Java
// we don't need to close wordlist_file
// it will be closed when the variable goes out of scope
AND// mutex is released here as _guard is dropped
That's a fancy name for good old garbage collector from Java
It would be a nonsensical idea to leave up to the garbage collector releasing an acquired lock on its own time. Such a situation could very easily cause a deadlock, as a program may be waiting on a lock that the garbage collector must release, but while the program is waiting on the lock, no additional garbage is being generated that might trigger a garbage collector run, nor is there any guarantee that even if that run does complete, that the objects you wanted finalized would be.
https://docs.oracle.com/javase/tutorial/essential/exceptions...