OMG! OMG! I DO!
Just erased while(1) parts and works well. And my thesis is %100 done. Thank you everybody.