adds syncing of threads in ex9