Change how synchronization lock obtained

We still need to implement an unsynchronized version of the complex math
operations.