Working with polymorphic thread