compeleted threading with more usefull global functions, added notify all, waiting queue and ...