Yes,you are right.I have used the same method: while(pointer == NULL){wait(1);}
it does well.Thank you.