added debug class
added support for thread in win/linux