全文预览

C 细说多线程(上下)(转)

上传者:随心@流浪 |  格式:pdf  |  页数:71 |  大小:8686KB

文档介绍
ked()*System.Thread+,-./6$\n1Monitor2%3ef'\r6() CompareExchangebDecrementbExchange> Increment [K%8&Zhi)j\rk$lminop'\rlncrement^ Decrement2hijkqr1 st1 uvwx_$yz'\r1 class Example\r2 (\rprivate int a=l;\r4\r5 public void AddOne ()\r6 (\rint newA=Interlocked.Increment(ref a);\r8 }\r9 }\rExchangejkq{|}z'\r1 public void SetData ()\r2 (\rInterlocked.Exchange(ref a,100);\r4 )\rCompareExchange2%~ij8€60*if $%& a [*1 ]‚ƒ100}z„a'\r1 public void CompareAndExchange ()\r2 (\r3 Interlocked.CompareExchange(ref a,100,1);\r4 ).\rGHI\r†‡ˆ‰@PŠ‹`"ŒVW\nŽK‘’“”!v•8&9–—˜™$šP\r3›œžŸ $¡¢'\r)£%¤¥¦$].§¨©ª$‰@PŠ‹8=«¬­®¯°>`Ÿ $±²³´©‘’\rN©µ¶$q8·¸¹º'\r`.NETŠ‹»¼$½¾¸r¿ÀÁÂÃQÄÅ".NETŒÆšP” žÈÃL

收藏

分享

举报
下载此文档