Click here to Skip to main content
15,913,944 members
Home / Discussions / C#
   

C#

 
GeneralRe: c# Stream buffer problem Pin
leppie11-Jun-04 20:53
leppie11-Jun-04 20:53 
GeneralRe: c# Stream buffer problem Pin
Heath Stewart12-Jun-04 4:49
protectorHeath Stewart12-Jun-04 4:49 
Generaljetaudio5, winamp5 and wmp9 Pin
Taha Elsayed11-Jun-04 16:29
Taha Elsayed11-Jun-04 16:29 
GeneralRe: jetaudio5, winamp5 and wmp9 Pin
Arjan Einbu11-Jun-04 23:22
Arjan Einbu11-Jun-04 23:22 
GeneralFinding and repeating a character Pin
Rostrox11-Jun-04 15:23
Rostrox11-Jun-04 15:23 
GeneralRe: Finding and repeating a character Pin
Rostrox12-Jun-04 3:40
Rostrox12-Jun-04 3:40 
GeneralThread locking Pin
link_7911-Jun-04 12:57
link_7911-Jun-04 12:57 
GeneralRe: Thread locking Pin
Xiangyang Liu 刘向阳11-Jun-04 13:28
Xiangyang Liu 刘向阳11-Jun-04 13:28 
Answer to Q1:

Fcn1 and Fcn3 will be synchronized, because they both lock "this", only one of them can go on at a time. Fcn2 will execute regardless what happens in Fcn1 and Fcn3, because it is locking a different object (obj2).

Answer to Q2:

Fcn2 and Fcn3 can execute concurrently, since they are modifying the same object, the code will not be thread-safe.

In general, if two blocks of code are locking the same object, then only one of them can be executed, the other will wait its turn. If they are locking different objects, even if one of the objects being locked is a member of the other object, the two blocks of code can execute concurrently.

Hope this helps.








My articles and software tools





GeneralRe: Thread locking Pin
link_7911-Jun-04 13:48
link_7911-Jun-04 13:48 
GeneralRe: Thread locking Pin
Meysam Mahfouzi11-Jun-04 17:21
Meysam Mahfouzi11-Jun-04 17:21 
GeneralRe: Thread locking Pin
Xiangyang Liu 刘向阳12-Jun-04 3:01
Xiangyang Liu 刘向阳12-Jun-04 3:01 
GeneralRe: Thread locking Pin
link_7913-Jun-04 9:57
link_7913-Jun-04 9:57 
GeneralRe: Thread locking Pin
Meysam Mahfouzi11-Jun-04 17:13
Meysam Mahfouzi11-Jun-04 17:13 
GeneralPlaceHolder, TreeView, UserControl Pin
caheo11-Jun-04 9:22
caheo11-Jun-04 9:22 
GeneralRe: PlaceHolder, TreeView, UserControl Pin
Heath Stewart11-Jun-04 10:40
protectorHeath Stewart11-Jun-04 10:40 
Questioninefficient to create new delegate every time? Pin
vista2711-Jun-04 8:10
vista2711-Jun-04 8:10 
AnswerRe: inefficient to create new delegate every time? Pin
Heath Stewart11-Jun-04 8:48
protectorHeath Stewart11-Jun-04 8:48 
QuestionRichTextBox cannot handle huge amount of color-coded, varied font text? Pin
vista2711-Jun-04 7:47
vista2711-Jun-04 7:47 
AnswerRe: RichTextBox cannot handle huge amount of color-coded, varied font text? Pin
Aaron Eldreth11-Jun-04 8:32
Aaron Eldreth11-Jun-04 8:32 
GeneralRe: RichTextBox cannot handle huge amount of color-coded, varied font text? Pin
vista2711-Jun-04 9:16
vista2711-Jun-04 9:16 
GeneralRe: RichTextBox cannot handle huge amount of color-coded, varied font text? Pin
Aaron Eldreth11-Jun-04 12:18
Aaron Eldreth11-Jun-04 12:18 
GeneralUpdate to DB Failure Pin
MrJJKoolJ11-Jun-04 7:44
MrJJKoolJ11-Jun-04 7:44 
GeneralRe: Update to DB Failure Pin
Colin Angus Mackay11-Jun-04 8:10
Colin Angus Mackay11-Jun-04 8:10 
GeneralRe: Update to DB Failure Pin
MrJJKoolJ11-Jun-04 8:33
MrJJKoolJ11-Jun-04 8:33 
GeneralRe: Update to DB Failure Pin
Heath Stewart11-Jun-04 8:49
protectorHeath Stewart11-Jun-04 8:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.