in c#, "lock" is a method to avoid racing condition, avoid multiple threads read and write to a shared variable between them.
lock usually will cause delay, lets say 1 thread locked and accessing a variable(and process until it unlock), all others thread cant lock, they all have to wait(or stuck) until somebody else lock, unlock, and wait until they able to lock(access the variable)
i wonder if there is alternative, like i want to know if the variable is locked, if its, pass, try it again next time, still lock, pass, basically i dont want certain thread get delay when they cant access a variable.
alternative to "lock" ?, c#
Mar 25 2024, 11:40 PM, updated 2y ago
Quote
0.0151sec
1.37
5 queries
GZIP Disabled