Click here to Skip to main content
11,478,642 members (65,809 online)
   

C#

 
AnswerRe: C#,ASP.Net Pin
Abhinav S1-Feb-13 9:16
mvpAbhinav S1-Feb-13 9:16 
Questionhow to change the background color of a selected row in datagridview [modified] Pin
NarVish31-Jan-13 22:37
memberNarVish31-Jan-13 22:37 
AnswerRe: how to change the background color of a selected row in datagridview Pin
OriginalGriff31-Jan-13 23:21
mvpOriginalGriff31-Jan-13 23:21 
GeneralRe: how to change the background color of a selected row in datagridview Pin
NarVish31-Jan-13 23:35
memberNarVish31-Jan-13 23:35 
GeneralRe: how to change the background color of a selected row in datagridview Pin
OriginalGriff31-Jan-13 23:38
mvpOriginalGriff31-Jan-13 23:38 
GeneralRe: how to change the background color of a selected row in datagridview Pin
Richard MacCutchan31-Jan-13 23:39
mvpRichard MacCutchan31-Jan-13 23:39 
GeneralRe: how to change the background color of a selected row in datagridview Pin
OriginalGriff31-Jan-13 23:46
mvpOriginalGriff31-Jan-13 23:46 
AnswerRe: how to change the background color of a selected row in datagridview Pin
Richard MacCutchan31-Jan-13 23:38
mvpRichard MacCutchan31-Jan-13 23:38 
GeneralRe: how to change the background color of a selected row in datagridview Pin
NarVish31-Jan-13 23:45
memberNarVish31-Jan-13 23:45 
QuestionHow to write events in event log using Log4net Pin
venkatpappu31-Jan-13 22:28
membervenkatpappu31-Jan-13 22:28 
AnswerRe: How to write events in event log using Log4net Pin
Richard MacCutchan31-Jan-13 23:11
mvpRichard MacCutchan31-Jan-13 23:11 
QuestionThread.Abort - using and lock statement Pin
devvvy31-Jan-13 16:49
memberdevvvy31-Jan-13 16:49 
AnswerRe: Thread.Abort - using and lock statement Pin
Dave Kreskowiak31-Jan-13 18:53
mvpDave Kreskowiak31-Jan-13 18:53 
GeneralRe: Thread.Abort - using and lock statement [modified] Pin
devvvy31-Jan-13 18:59
memberdevvvy31-Jan-13 18:59 
Dave Kreskowiak wrote:
The same as usually.

I don't like "Usually" ...
I read from somewhere that [^]lock(x) statement is syntactic sugar, that JIT compiler will autogenerate the following:

Monitor.Enter(o);
S0;
try {
S1;
} finally {
Monitor.Exit(o);
}

However, for some compiler architecture, your code will not cleanup properly if Thread.Abort called at point "S0" above before the generated try block, thus Monitor.Exit will not be exited.
But hold - I just found out the answer - I missed the update from the referenced post which says M$ corrected the problem:

Update 4/17/08: This was indeed fixed for the X64 JIT in Visual Studio 2008. Note that when compiling C# code targeting both X86 and X64, if you do not use the /o+ switch, this problem can still occur due to extra explicit NOPs inserted before the try.

The framework implements a method Monitor.ReliableEnter, by the way, that could be used to avoid orphaning locks in the face of thread aborts, but it's internal to mscorlib.dll. It sets an out parameter within a region of code that cannot be interrupted by a thread abort, which the caller can then check inside the finally block. The acquisition then gets moved inside so that, if the CALL is reached, the finally block is guaranteed to always run. You'd then write this instead:

bool taken;
try {
Monitor.ReliableEnter(o, out taken);
S1;
} finally {
if (taken)
Monitor.Exit(o);
}


Problem solved!
dev


modified 1-Feb-13 0:09am.

GeneralRe: Thread.Abort - using and lock statement Pin
Dave Kreskowiak31-Jan-13 20:05
mvpDave Kreskowiak31-Jan-13 20:05 
GeneralRe: Thread.Abort - using and lock statement Pin
devvvy31-Jan-13 20:07
memberdevvvy31-Jan-13 20:07 
GeneralRe: Thread.Abort - using and lock statement Pin
devvvy6-Nov-13 18:13
memberdevvvy6-Nov-13 18:13 
Questionbuild C# as windows app Pin
dcof31-Jan-13 13:12
memberdcof31-Jan-13 13:12 
AnswerRe: build C# as windows app Pin
Mycroft Holmes31-Jan-13 14:51
memberMycroft Holmes31-Jan-13 14:51 
AnswerRe: build C# as windows app Pin
Dave Kreskowiak31-Jan-13 15:53
mvpDave Kreskowiak31-Jan-13 15:53 
AnswerRe: build C# as windows app Pin
Abhinav S31-Jan-13 23:37
mvpAbhinav S31-Jan-13 23:37 
AnswerRe: build C# as windows app Pin
Pete O'Hanlon1-Feb-13 0:40
protectorPete O'Hanlon1-Feb-13 0:40 
QuestionC# and ADP (Automatic Data Processing) integration Pin
Dan_YYC31-Jan-13 6:18
memberDan_YYC31-Jan-13 6:18 
AnswerRe: C# and ADP (Automatic Data Processing) integration Pin
Dan_YYC4-Feb-13 4:56
memberDan_YYC4-Feb-13 4:56 
QuestionAuto relocate a label Pin
justcop31-Jan-13 5:41
memberjustcop31-Jan-13 5:41 
AnswerRe: Auto relocate a label Pin
Abhinav S31-Jan-13 7:13
mvpAbhinav S31-Jan-13 7:13 
AnswerRe: Auto relocate a label Pin
Dave Kreskowiak31-Jan-13 8:02
mvpDave Kreskowiak31-Jan-13 8:02 
AnswerRe: Auto relocate a label Pin
Eddy Vluggen31-Jan-13 11:22
mvpEddy Vluggen31-Jan-13 11:22 
QuestionUpload files over HTTPS Pin
Edis Husic31-Jan-13 2:37
memberEdis Husic31-Jan-13 2:37 
QuestionADAM LDAP Authentification via user distinguishedName Pin
mappy7501730-Jan-13 23:41
membermappy7501730-Jan-13 23:41 
QuestionSubreport Pin
theezin30-Jan-13 23:16
membertheezin30-Jan-13 23:16 
AnswerRe: Subreport Pin
Pete O'Hanlon30-Jan-13 23:22
protectorPete O'Hanlon30-Jan-13 23:22 
QuestionHow to write c# version of Delphi's Abort procedure Pin
Xiaoming Qian30-Jan-13 19:46
memberXiaoming Qian30-Jan-13 19:46 
AnswerRe: How to write c# version of Delphi's Abort procedure Pin
Richard MacCutchan30-Jan-13 23:07
mvpRichard MacCutchan30-Jan-13 23:07 
AnswerRe: How to write c# version of Delphi's Abort procedure Pin
Shameel31-Jan-13 1:18
memberShameel31-Jan-13 1:18 
AnswerRe: How to write c# version of Delphi's Abort procedure Pin
jschell31-Jan-13 9:21
memberjschell31-Jan-13 9:21 
Question"new" to hide base class implementation - is it useless? [modified] Pin
devvvy30-Jan-13 19:17
memberdevvvy30-Jan-13 19:17 
AnswerRe: "new" to hide base class implementation - is it useless? Pin
Keld Ølykke30-Jan-13 21:03
memberKeld Ølykke30-Jan-13 21:03 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
devvvy30-Jan-13 21:11
memberdevvvy30-Jan-13 21:11 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
Keld Ølykke31-Jan-13 0:45
memberKeld Ølykke31-Jan-13 0:45 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
devvvy31-Jan-13 16:33
memberdevvvy31-Jan-13 16:33 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
Keld Ølykke31-Jan-13 21:56
memberKeld Ølykke31-Jan-13 21:56 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
devvvy1-Feb-13 15:54
memberdevvvy1-Feb-13 15:54 
AnswerRe: "new" to hide base class implementation - is it useless? [modified] Pin
markovl30-Jan-13 22:20
membermarkovl30-Jan-13 22:20 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
devvvy31-Jan-13 16:30
memberdevvvy31-Jan-13 16:30 
AnswerRe: "new" to hide base class implementation - is it useless? [modified] Pin
Shameel31-Jan-13 2:07
memberShameel31-Jan-13 2:07 
AnswerRe: "new" to hide base class implementation - is it useless? Pin
Abhinav S31-Jan-13 7:25
mvpAbhinav S31-Jan-13 7:25 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
devvvy31-Jan-13 16:40
memberdevvvy31-Jan-13 16:40 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
Abhinav S31-Jan-13 23:26
mvpAbhinav S31-Jan-13 23:26 
GeneralRe: "new" to hide base class implementation - is it useless? Pin
devvvy1-Feb-13 15:56
memberdevvvy1-Feb-13 15:56 

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

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


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 22 May 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid