Avoid using static mutex and recursive mutex as the resource to be acquired/release. Instead, create a specific lock for each call if it does not exist.