Disable Actions Concurrency - marcos8154/SocketAppServer GitHub Wiki
The framework allows certain Server Actions to work with non-concurrent access even though the server is multi-threaded. This may be necessary in some of your project-specific routines where execution can only happen synchronously, so without competition
The code snippet below will cause Action to only respond to one client at a time, preventing more than one client from simultaneously accessing the resource:
public ActionResult MyNonConcurrentActionExample(params.....)
{
ActionLocker.AddLock(this, "MyNonConcurrentActionExample");
}
The "AddLock()" method of the ActionLocker class will mark Action as nonconcurrent. From there, only one client at a time will be able to access the resource on the server, making other clients wait.
The server will release the lock automatically as soon as Action has finished executing, releasing it to the next client. And so on and on the cycle repeats itself