Advise about implementing roulette like chat
-
Hi, Im implementing a roulette like chat in asp.net and i having some issues about the logic. The basic flow of the application should be : 1. user signed in to the site 2. user requesting someone to chat to 3. the request is sent to the server and the server draws a random user to chat to 4. the two user start communicating, The problem i seem to have is that when a user request is reaching the server and the server tries to draw a new user to chat to (lets say from a DB) , how i synchronize that user with the drawn one, because its a multi-thread environment the user that i drew may also did the same function and tried to drew a user to. So i will face a problem that the first user assigned to himself the other user and the other user may assigned to himself other user as well. Is this a common problem? and if so what is the common solutions? thank you.