Another option I just thought of might work as well. You could use the Management::DBVariable interface to create a "locking" variable implemented as a record in the configuration database. The DBVariable sample in the SDK shows how to list, create, delete, get and set database variables.
You could then from your nodes, query this values existence. If it's not set, then set it and do your work. Something like this:
set lock = value-of icontrol.lock varaible
if error
create icontrol.lock variable with value of 1
do work
delete icontrol.lock variable
else if lock == 0
set icontrol.lock variable with value of 1
do work
delete icontrol.lock variable
else if lock == 1
sleep and try again
With this approach there is still a chance of a collision if parallel requests are going in at the same time. Both could query the value of the variable at the same time and fall into the same condition.
Not sure which will work better for you but this will give you a couple of options.
-Joe