This is not how I think a lock should be used.
A lock should stop, the thread till the resource is free again and then continue. See this post for example.
At the beginning of your rule you test the lock and skip if it is locked, but then you loose the call, so when the calculation is still ongoing you loose the next value.
Secondly I don’t see a reason why you need a lock at all. There is no shared resource or anything else which obviously needs to be locked.