I don't get what you mean. At that point in time waiting_queue is in the right scope, therefore it should be right to use it as a buffer. 
If the compiler does not try to play tricks on us, the call to CollectCallGetPending should be finished before the evaluation of the condition (waiting_queue > COLLECT_WINDOW) happens, or am I missing something?