test for completion
while((p != null) || !empty(&s))