??? ????? ?????? ???????

?????? ????????? ?????? ?????????
???? ???????: 317723 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

.NET ?? Visual Basic ?? Visual Basic 2005 ???? ?????? ??? ??????? ?????? ??????? ?? ??????? Visual Basic ???? ???. ????? ?????? ????? ????? ??????? ??? deadlocks ????? ??????. ?????? ??? ?????? ????? ?????????.

??????? ????

????? ??????

???? ???? ???? ??? ?????? ??????? ??? ?????? ??? ????? ????? ?? ??? ?????. ???? ??????? ????? ?????? ??????? ?????? ???? ????? ??? ???? ?????? ?? ???????. ?? ????? ???? ??????? ????? ??????? ?? ???? ????? ???????? ?????? ??? ??? ??????? ????? ????? ?? ???? ????? ???? ????? ?????? ??????? ??? ????? ?????. ???? ???? ??????? ???? ???? ????? ??? ??? ????????? ??? ???? ??????? ?????? ???? ??? ??????? ??????.

?????? ???????

??? ????? ?? ???? ????? ???? ????? ?????? ??? ????? ???? ??????. ??? ?????? ????? ???? ???? ????? ???????? ??? ??? ???? ???? ??????? ??? ???? ??????? ?? ???????? ????? ??????? ?? ????? ???? ??????? ??????.

??? ???? ?? ??? ??? ???? ????? ???? ????? ??? ?????? ?????? ?????? ????? ???? ???? ?????. ???? ?????? ??????? ???? ??????? ??? ????? ????? ????? ???? ???????? (???? ??? ?????? ? dword ptr ds: [031B49DCh] ?? ????????? ???????? ???????).

????????? ???????? ? Visual Basic:
   'Thread 1
   Total = Total + val1
				
   'Thread 2
   Total = Total - val2
				
??? ??????? (?? ????? ??????) ?? ??????? ??????? ????????? ???????? ? Visual Basic ???????:
 'Thread 1
 1.   mov         eax,dword ptr ds:[031B49DCh] 
 2.   add         eax,edi 
 3.   jno         00000033 
 4.   xor         ecx,ecx 
 5.   call        7611097F 
 6.   mov         dword ptr ds:[031B49DCh],eax 
				
 'Thread 2
 1.   mov         eax,dword ptr ds:[031B49DCh] 
 2.   sub         eax,edi 
 3.   jno         00000033 
 4.   xor         ecx,ecx 
 5.   call        76110BE7 
 6.   mov         dword ptr ds:[031B49DCh],eax 
				
?????? ??? ????????? ???????? ???????? ????? ?? ??? ?? ??? ?????? ???? ??????? ??? ??????? ?????? ?????? ????? ?????? ????? ?????. ???? ????? ?? ???? ?????? ??? ????? ?? ?? ??? ?? ????????? ???????? ?????? ?? ??????? ???? ??? ???????. ???? ???? ????? ???? ???? ????? ?? ??? ???????.

??? ?????? 100 ? val1 ?? 50 val2 ?? 15. ???? ??? ???? ?????? ???? ????? 1 ??? ??? ????? ??????? ?? 1 ??? 3. ???? ???? ?? ???? ????? 1 ????? ??????? ?????? ???????. ??? ???????? ???? ????? 1 ??? ????? ???? ????? 150. ??? ????? ???? ??????? 1? ???? ????? 2 ???? ??? ??????? ??????. ???? ???? ??? ?? ????? ?????? ???? ???? (85) ?????? ??????? ???????. ???????? ???? ????? 1 ?????? ???? ?????? ??????? ???????. ??? ???? ?? ????? (150). ????? ??? ???????? ?? ???? ????? 1 ???? ?????? ???? 150 ????? ?? 85.

????? ?? ??? ??? ???? ?? ???? ??? ????? ??????. ??? ??? ?????? ?????? ??? ?????? ??????? ?? ?????? ???? ??? ?? ?? ???? ??????.

??? ????? ????????? ???? ???? ????? ????? 1 ?????? ??????? ????? ?? ??? ????? ??? ?????? ???????? ?? ????? ????? 2 ???? ????? ??????? ????? ??. ?? ???? ???? ??? ???????? ?? ???? ???????. ????? ???? ??????? ??? ???????? ????? ????? ?????? ?????? ?? ??? ???????. ???? ???? ????? ?????? ??????? ?? ????? ?? ??? ??????? ????? ??? ???????. ????? ????? ?? ??? ??? ?? ???? ????? ?? ???? ????? ?? ?????? ?? ???? ?????. ???? ??? ????????? ??? ??????? ???? ????? ????? ??????.

???? ???? ????? ??????? ????? ????? ??????? ??????? ??? ?? ?????? ??? ??????? ??????? ????? ????? ???? ??? ?? ??? ???????. ??? ???? ???? ??? ?? ????? ????? ?? ???? ????? 1 ?????? ???? ????? 2 ???? ???????? ????? ??????? 2 ???? ????? ????? ?????? ???? ????? 2 1 ???? ??????? ?????? ???????. (????? ?? ?????????? ???? "SyncLock" ?? ??? "???????" ?? ??? ???????).

???????

??????? ?????? ?????? ????? ?????? ?? ??? ????????? ???? ??? ???????? ??? ??? ?????? ????? ??? ??????. ???? ??? ?? ??? ??????? ?????? ???? ??? ????? ?????? ???????. Wins ???? ????? ???? ?? ??? ??? ??? ??? ?? wins ???? ????? ???. ??? ????? ????? ??????? ???? ???? ????. ????? ??? ?? ????? ?? ???? ????? ???? ?????? ???? ??????? ???? ???? ????.

????? ?????? ?????

???? ???? ??? ??? ?????? ??????? ??? ?? ????? ????? ????? ?? ??? ????? ??????? ????? ??????? ???? ??????? ????? ??????. ??????? ????? ????? ????? ?? ???? ????? ?????? ???? ????? ??? ?????? ???????. ??? ?? ???? ????? ????? ??????? ???? ???? ???? ???????? ?? ??? ????? ???? ?????? ??????? ???????.

?????? ???????

????????? ???????? ??????? ??? ?????? ??????? ????????:
'Thread 1
SyncLock LeftVal
 SyncLock RightVal
  'Perform operations on LeftVal and RightVal that require read and write.
 End SyncLock
End SyncLock
				
'Thread 2
SyncLock RightVal
 SyncLock LeftVal
  'Perform operations on RightVal and LeftVal that require read and write.
 End SyncLock
End SyncLock
				
???? ???? ??? ????? ???? ?????? ??????? 1 ???? ???????. ????? ????? 1 ???? ????? ??????? ????? ????? ???? ????? 2. ??? ??????? 2 ??????? ?? ????? ????? ???????. ???? ?? ????? ???????? ????? ???? ????? 2 ?????? ??????? ???? ???????. ???? ?? ????? ???? ??????? 2? ??????? 1 ???? ??????? ?????. ???? ??????? 1 ????? ????? ??????? ??? ?? ???? ????? ????? 2 ?? ??????. ????? ????? ???? ???? ??????? 1 ??? ???????? ??? ???? ?????? ???????. ?? ???? ????? ????? ???? ????? ???? ??? ?? ???? ????? ?????? ??????? ?? ?????? ???? ???????? ???? ??? ?? ???? ????? ??????? ???? ??? ?????.

?? ???? ???? ???? ??? ??????. ??? ??? ????? ???? ????? 1 ??? ??????? ??? ????? ???????? ???? ????? 1 ????? ??????? ??? ????? ????? ??????? ???????. ??? ????? ???? ??????? 1 ????? ???????? ???? ????? 2 ?????? ??????? ????? ?? ??? ?? ?????.

??? ????? ???? ????? ????? ???? ??? ????? ??????? ?????? ???? ??? ???? ???? ?? ???????? ???????? ?? ???? ???????? ???????? ?? ??????? ??????? ???????? ?? ????? ????????? ???????? ?????? ??. ??? ??? ???? ???? ????? ??? ?? ??? ????????? ???????? ?????? ?? ?? ??????? ?????? ???????? ??? ???? ???? ?? ????.

???????

??? ????? ????? ????? ???? ??? ?? ???? ???????? ?? ?????? ?? ???????? ?? ?????????. ??? ???? ???? ?????. ?????? ????? ??? ????? ?????? ?? ????? ????? ??????? ??????. ?????? ??????? ?? ??? ?????????? ??? ???? ?? ???? ????? ????? ?? ??? ?????? ????? ???. ?? ????? ???????? ?????? ?? ???? ?????? ???????? ??? ??? ?? ??? ??? ???????? ??? ??????? ??????.

?? ?? ???? ??????

??? ??????? ???????? ???? ????????? ???????? ???? ???? ?? ??? ???? ??? ???? ??????? ????. ?? ??? ????? ???????? ??? ???? ???????? ???? ?????? ??????? ???????. ???? ????? ???? ???????. ???? ???? ??????? ??? ??????? ????? ????? ?????? ???? ????? ???????. ????? ????? ???? ?? ????? ??? ?????? ????? ?????? ???????. ????? ?? ???? ????? ??????? ????????? ????? ??? ????? ???????? ??????? ?? ??????? ???? ???????? ???? ??????? ???? ???? ???? ??????? ?? ???? ???? ??????? ?? ???? ????? ??????? ????? ?? ????? ????? ???? ?? ?????? ??? ???????. ?????? ???? ??? ?? ????? ???? ????? ??? ??????? ?? ????? ???????. ?????? ????? ???? ????????? ?? ???? ??????? ????? ?????? ?????? ??????. ????? ??? ????????? ?????? ???? ??????? ?? ??????? ??????? ????? ??????????? ???? ????? ????? ??????? ???????.

?????

????? ?? ?????????? ???? ??????? Visual Studio ??????? ???????? ???????:
  • SyncLock. ???? ???? ???? ???????. ??? ??? ???? ????? ??? ????? ????? ????? ??? ??? ??? ??? ???? ???????. ?????? SyncLock ??????? ???? ???? ?? ???? ??????? ?? ????? ??????? SyncLock. ??? ???? ??????? ???? ??? ????? ?????? ??? ????? ?? ????? ????? ?????? ?????.
  • ???????. ???? ????? ?????? ?? ?????? ????? ??? ????????? ??????? ????????.
?????? ??? ??????? ??????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ? Microsoft":
316422 ???????: ??????? ????? ??????? ?? Visual Basic.NET
????? ?? ?????????? ???? ???? MSDN ??? ???:
?????? ????? ????? ???????

???????

???? ???????: 317723 - ????? ??? ??????: 23/?? ?????/1434 - ??????: 3.0
????? ???
  • Microsoft Visual Basic 2005
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic .NET 2002 Standard Edition
????? ??????: 
kbvs2005swept kbvs2005applies kbinfo kbmt KB317723 KbMtar
????? ????
???: ??? ????? ??? ??????? ???????? ????? ?????????? ??????? ?????? ??? ??????? ?? ??? ??????? ?? ??????? ??? ??? ?? ???? ????????? ???? ??????? ???????(CTF) ?? ?? ???? ????? ????. ???? ?? ???? ?????????? ??? ???????? ???????? ???? ??? ?? ???????? ??????? ?? ??? ??????? ???????? ?? ??? ??????? ??????? ??? ?????? ?? ?????? ??? ???? ???????? ???????? ?? ????? ??????? ????? ????? ??????. ??? ?? ???????? ???????? ?? ????? ??? ????? ?? ???????? ?? ???? ????? ?? ?????. ?????? ??? ???? ?????????? ???? ?????? ?? ??? ????? ?? ??? ??? ?? ??????? ?? ??? ????? ?? ???? ????? ????? ?? ????? ??????? ???? ?? ???????? ?? ??? ???????.
???? ??? ????? ??????? ?????? ??????????317723

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com