Patent attributes
Concurrency control in an asynchronous event-loop based program environment is described. A program is implemented with an asynchronous event-loop. A first piece of code controls events into the program by preventing events from being delivered to the program while a storage operation is executing except for storage completion events. Those events are prevented from being delivered to the program until the storage operation completes and the program is not executing code. A second piece of code controls outgoing messages from the program by preventing outgoing messages from being transmitted when a storage write operation is in progress except for outgoing messages that are storage write operations. Upon the successful completion of the storage write operation, the outgoing messages that were prevented from being transmitted are transmitted.