I would firstly assume sync
block has the same semantics of pthread_mutex_lock
. When the execution outside of transactions reaches sync
block, it would gain exclusive access to this critical region, and all other executions, either inside or outside transactions, are blocked if they try to enter the critical region.
When the execution inside of transactions reaches sync
block, it would gain non-exclusive access to this critical region, which could be obtained by any other executions inside transactions, but executions outside transactions would be blocked.
In other words, the mutex lock inside the transactions becomes a reader lock, and mutex lock outside the transactions becomes a writer lock.