In order to share variables, static type variables are defined, but since asp.net is a typical multi-threaded application, when multiple threads execute this set of code at the same time, an error occurs. How to solve it?
If you use lock to solve the problem, when there are too many visitors, there will be a phenomenon that the page cannot be opened by clicking (deadlock). Is there any other way?
The static type of shared variables requires a small amount of processing, and the processing speed is extremely fast every time.If your processing of static type shared variables is very long every time, then it can only be said that it is a mistake in your design and should be reconsidered. or You use Mutex.WaitOne for timeout handling