作者missbus (smile)
看板C_Sharp
标题[问题] 请教thread问题
时间Mon Aug 4 13:32:18 2008
小弟最近在写C# 有用到thread
可是有些东西run出来结果会不如预期
比如说小弟自己写一个有thread的程式 (如下)
http://rafb.net/p/nY6LmJ63.html
run出来的结果是
hello object 1 -- ContextID: 0 -- 1
hello object 1 -- ContextID: 0 -- 2
hello object 1 -- ContextID: 0 -- 3
hello object 1 -- ContextID: 0 -- 4
hello object 1 -- ContextID: 0 -- 6
hello object 1 -- ContextID: 0 -- 7
hello object 1 -- ContextID: 0 -- 8
hello object 1 -- ContextID: 0 -- 9
hello object 1 -- ContextID: 0 -- 10
hello object 1 -- ContextID: 0 -- 11
hello object 2 -- ContextID: 0 -- 5
hello object 2 -- ContextID: 0 -- 12
hello object 2 -- ContextID: 0 -- 13
hello object 2 -- ContextID: 0 -- 14
hello object 2 -- ContextID: 0 -- 15
hello object 2 -- ContextID: 0 -- 16
hello object 2 -- ContextID: 0 -- 17
hello object 2 -- ContextID: 0 -- 18
hello object 2 -- ContextID: 0 -- 19
hello object 2 -- ContextID: 0 -- 20
======================================================
小弟心中有个疑问...
为什麽会跑出回色那一个呢?
我都已经用lock了她跑出来还是没有按照顺序累加
请问板上精研c_sharp的程设先辈不吝指教
感恩~
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.115.158.22