cli icon indicating copy to clipboard operation
cli copied to clipboard

Fix mutex initialization issue in cli library

Open elyorbek010 opened this issue 1 year ago • 1 comments

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.

elyorbek010 avatar Dec 13 '24 11:12 elyorbek010

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

daniele77 avatar Jan 22 '25 17:01 daniele77