lock inside lock

后端 未结 3 1979
挽巷
挽巷 2021-02-06 20:16

I\'m wondering if this construction will cause an error:

lock(sync)
{
  // something
  lock(sync)
  {
    //something
    lock(sync)
    {
      //something
             


        
3条回答
  •  北海茫月
    2021-02-06 20:43

    According to MSDN (see here and here) this is well-defined behaviour and causes no problem.

提交回复
热议问题