GUIGAL Allan
10/13/2021, 6:06 PMephemient
10/13/2021, 6:13 PMGUIGAL Allan
10/14/2021, 5:32 AMDALDEI
10/18/2021, 10:38 PMephemient
10/19/2021, 1:10 AMlaunch { lock(); suspend(); unlock() }
launch { lock(); suspend(); unlock() }
both of suspend()
may run concurrently because lock()
is reentrant and allows the same thread to freely re-acquire a lock that is already owned by itwithContext(<http://Dispatchers.IO|Dispatchers.IO>) { lock(); suspend(); unlock() }
may resume on a different Java thread, which is also a problem for reentrant mutexes as they keep track of the owning thread