Threading behaviour and locking

I have some events in blueprint that take a while to complete and I don’t want them to be called during that time. I cannot find a simple way to guard them.

First attempt: Create a boolean variable, check its value at the start of the event, then switch it and switch it again at the end of the event. This does not work for some reason. My guess is that the variable is only synchronized at the end of the event. Is that true?

Second attempt: Create a events ‘AcquireLock’ and ‘ReleaseLock’ to set a boolean variable, only enter the main event when that variable has the correct value, acquire the lock and release it in the end. This works but I cannot set events to private, so is kind of hacky. Also, even more boilerplate would be needed to make this exception safe

Is there a better/more idiomatic way to achieve locking in Blueprint? I don’t see any lock objects that I could use.

Additionally you can try to use Gate node.