When someone signs up for my website they must sign up with a unique user name. My current pseudocode for this is:
if(datastore.nameIsAvailable(name)){
datastore.createUser(name);
}
How do I make sure that in between the time when nameIsAvailable
returns true, and the createUser
is finished, another instance of my app doesn't create a user with the same name?