Click here to Skip to main content
15,901,035 members
Home / Discussions / C#
   

C#

 
GeneralRe: using this as synchronization object Pin
George_George23-Mar-08 2:53
George_George23-Mar-08 2:53 
GeneralRe: using this as synchronization object Pin
girm22-Mar-08 4:09
girm22-Mar-08 4:09 
GeneralRe: using this as synchronization object Pin
George_George23-Mar-08 2:54
George_George23-Mar-08 2:54 
GeneralRe: using this as synchronization object Pin
girm24-Mar-08 8:19
girm24-Mar-08 8:19 
GeneralRe: using this as synchronization object Pin
George_George24-Mar-08 19:01
George_George24-Mar-08 19:01 
GeneralRe: using this as synchronization object Pin
Colin Angus Mackay22-Mar-08 4:06
Colin Angus Mackay22-Mar-08 4:06 
GeneralRe: using this as synchronization object Pin
George_George23-Mar-08 2:51
George_George23-Mar-08 2:51 
GeneralRe: using this as synchronization object Pin
Colin Angus Mackay23-Mar-08 4:06
Colin Angus Mackay23-Mar-08 4:06 
George_George wrote:
Why using internal private object as lock object will reduce chance of deadlock compared with using this object? Could you describe a scenario please?


Well, if you use a private object then nothing outside the class can access the object. That means that you have full control within the class of how instances of the class are synchronised.

If you use "this", and other code uses the reference to the same object then they can interfere with each other. There isn't much you can do to defend yourself from code that you have not written and have no control over.

Upcoming FREE developer events:
* Developer Day Scotland

Recent blog posts:
* Mixins in C#3.0

My website | Blog

GeneralRe: using this as synchronization object Pin
George_George23-Mar-08 4:17
George_George23-Mar-08 4:17 
QuestionHow do I create a subclass dynamically from a base class? [modified] Pin
loderxp22-Mar-08 2:57
loderxp22-Mar-08 2:57 
AnswerRe: How do I create a subclass dynamically from a base class? Pin
pmarfleet22-Mar-08 3:41
pmarfleet22-Mar-08 3:41 
Questionhow to search particular word Pin
sugunavathysubramanian22-Mar-08 1:04
sugunavathysubramanian22-Mar-08 1:04 
AnswerRe: how to search particular word Pin
Christian Graus22-Mar-08 11:43
protectorChristian Graus22-Mar-08 11:43 
GeneralRe: how to search particular word Pin
sugunavathysubramanian24-Mar-08 20:24
sugunavathysubramanian24-Mar-08 20:24 
GeneralRe: how to search particular word Pin
Christian Graus24-Mar-08 21:09
protectorChristian Graus24-Mar-08 21:09 
Generalsynchronization object choosing Pin
George_George22-Mar-08 0:36
George_George22-Mar-08 0:36 
GeneralRe: synchronization object choosing Pin
Colin Angus Mackay22-Mar-08 3:12
Colin Angus Mackay22-Mar-08 3:12 
GeneralRe: synchronization object choosing Pin
George_George22-Mar-08 3:28
George_George22-Mar-08 3:28 
GeneralRe: synchronization object choosing Pin
Colin Angus Mackay22-Mar-08 3:36
Colin Angus Mackay22-Mar-08 3:36 
GeneralRe: synchronization object choosing Pin
George_George22-Mar-08 3:39
George_George22-Mar-08 3:39 
Questionhow to use UltimateSearchInput in .net with c# Pin
sugunavathysubramanian21-Mar-08 23:53
sugunavathysubramanian21-Mar-08 23:53 
Questionnested lock? Pin
George_George21-Mar-08 23:10
George_George21-Mar-08 23:10 
AnswerRe: nested lock? Pin
Colin Angus Mackay21-Mar-08 23:49
Colin Angus Mackay21-Mar-08 23:49 
GeneralRe: nested lock? Pin
George_George22-Mar-08 0:44
George_George22-Mar-08 0:44 
GeneralRe: nested lock? Pin
Colin Angus Mackay22-Mar-08 3:09
Colin Angus Mackay22-Mar-08 3:09 

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.