Atomic Operations/Mutex/Semaphore?

Anything like this exist in the scripting world? I have a script that I would like to ensure atomic access to an array in. Is there any way to do it?

-Eric