Fix race condition. Check ateof field after the sema down since it gets set by the thread doing the up.
Fix race condition.
Check ateof field after the sema down since it gets set by the thread
doing the up.

zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb