[Anizoptera] Thread component: Some refactoring, fixes and improvements
Merge changes to AzaThread subtree