Microbenchmarking of synchronization in threads