use barrier instead of condition variable for finished