4 ms·
Eh, that's a little bit of a FUDdy statement. You don't instantly have "locking issues" and/or "race conditions" to worry about just because you use an async co
by drub0y 14y ago
Eh, that's a little bit of a FUDdy statement. You don't instantly have "locking issues" and/or "race conditions" to worry about just because you use an async controller with the TPL (async keyword in .NET 4.5). The only time you have to deal with locking and race conditions is if the work you're doing is trying to cooperate and/or touching a shared resource (e.g. a static field). In the most common/basic case of receive a web request, fire off a call to a database/remote service asynchronously and wait for it to come back before you continue processing the original request you don't have to worry about anything because you're not sharing any local state and I would hope the database/remote service you're talking to has its own locking.
That's not to say that there aren't merits to node's single threaded execution model in that, _when you do_ need to access a shared resource, you don't have to worry about locking/coordination, but that's a whole other debate. :)