Fix mutex initialization issue in cli library
This PR resolves an issue where a mutex was being used in servant thread before it was initialized, causing undefined behavior. The mutex is now properly initialized before any use.
Hi @elyorbek010 and thanks for your contribution. The comment says:
This PR resolves an issue where a mutex was used in the servant thread before it was initialized, causing undefined behavior. The mutex is now properly initialized before any use.
I see that the mutex was not declared in the right place!
However, I see that you also added a new flag called "closing" which I think is unnecessary, because "enabled" is put to false only temporarily when a command is issued. On shutdown "enabled" is false, so the thread is not blocked on the condition variable.
Do you agree with my analysis? Can we remove the "closing" flag?
Thanks, Daniele