第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

C# 關(guān)于lock關(guān)鍵字的疑惑...高手請(qǐng)進(jìn)...

C# 關(guān)于lock關(guān)鍵字的疑惑...高手請(qǐng)進(jìn)...

揚(yáng)帆大魚 2018-07-26 12:05:17
string a="abc";lock(a){....};在實(shí)際使用中我發(fā)現(xiàn)鎖定的不是a對(duì)象,而是以a對(duì)象作為標(biāo)識(shí)的{}內(nèi)的代碼塊.. 但發(fā)現(xiàn)資料上是像圖中那樣說的,是我沒理解正確呢還是資料錯(cuò)誤?請(qǐng)高手解惑.using System;using System.Threading;class Program {      static void Main(string[] args)     {         Student s = new Student { Name="yh"};         Thread t=new Thread (new ThreadStart(()=>{lock (s) { Thread.Sleep(100000); }}));         t.Start();         Thread.Sleep(1000);         Console.WriteLine(s.Name);//這里沒有等鎖的線程結(jié)束才執(zhí)行..所以我覺得資料說的不對(duì)..你們認(rèn)為呢?                  Console.ReadKey();     }   }internal class Student {    public string Name { get; set; }
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 848 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)