Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
GeneralRe: AcceptSocket and ObjectDisposedException Pin
Harvey Saayman24-Jun-08 10:17
Harvey Saayman24-Jun-08 10:17 
AnswerRe: AcceptSocket and ObjectDisposedException Pin
Harvey Saayman24-Jun-08 10:10
Harvey Saayman24-Jun-08 10:10 
AnswerRe: AcceptSocket and ObjectDisposedException Pin
Anthony Mushrow24-Jun-08 10:41
professionalAnthony Mushrow24-Jun-08 10:41 
Answer*slaps self across face* Pin
Anthony Mushrow25-Jun-08 2:41
professionalAnthony Mushrow25-Jun-08 2:41 
QuestionC# and Services/Event Viewer Pin
SpankyNuts24-Jun-08 9:11
SpankyNuts24-Jun-08 9:11 
AnswerRe: C# and Services/Event Viewer Pin
led mike24-Jun-08 9:33
led mike24-Jun-08 9:33 
AnswerRe: C# and Services/Event Viewer Pin
Ravi Bhavnani24-Jun-08 14:26
professionalRavi Bhavnani24-Jun-08 14:26 
GeneralC# locks and atomicity Pin
Judah Gabriel Himango24-Jun-08 8:49
sponsorJudah Gabriel Himango24-Jun-08 8:49 
I'm seeing a debug assertion failure in our code that makes me question how much I know about atomicity. Should this Debug.Assert ever fail?

private object syncObject = new object();
private bool isWorking;

void Foo()
{
     lock (syncObject)
     {
         if (!isWorking)
         {
             isWorking = true;
             new Action(DoSomething).BeginInvoke(OnDoSomethingCompletedAsync, null);
         }
     }
}

void DoSomething() { }

void OnDoSomethingCompletedAsync(IAsyncResult result)
{
     lock (syncObject)
     {
         Debug.Assert(isWorking); // <------- This randomly fails...maybe once every few months.
         isWorking = false;
     }
}
Should this ever happen? I can say for certain that these are the only 2 functions I read or write to the isWorking field. Any idea what's going on?



Life, family, faith: Give me a visit.

From my latest post: "A lot of Christians struggle, perhaps at a subconscious level, about the phrase "God of Israel". After all, Israel's God is the God of Judaism, is He not? And the God of Christianity is not the God of Judaism, right?"

Judah Himango


GeneralRe: C# locks and atomicity Pin
Ennis Ray Lynch, Jr.24-Jun-08 10:09
Ennis Ray Lynch, Jr.24-Jun-08 10:09 
GeneralRe: C# locks and atomicity Pin
Judah Gabriel Himango24-Jun-08 10:23
sponsorJudah Gabriel Himango24-Jun-08 10:23 
GeneralRe: C# locks and atomicity Pin
Ennis Ray Lynch, Jr.24-Jun-08 10:38
Ennis Ray Lynch, Jr.24-Jun-08 10:38 
GeneralRe: C# locks and atomicity Pin
Judah Gabriel Himango24-Jun-08 11:21
sponsorJudah Gabriel Himango24-Jun-08 11:21 
GeneralRe: C# locks and atomicity Pin
User 665824-Jun-08 10:34
User 665824-Jun-08 10:34 
GeneralRe: C# locks and atomicity Pin
Judah Gabriel Himango24-Jun-08 11:10
sponsorJudah Gabriel Himango24-Jun-08 11:10 
GeneralRe: C# locks and atomicity Pin
User 665824-Jun-08 11:21
User 665824-Jun-08 11:21 
GeneralRe: C# locks and atomicity Pin
Joe Woodbury24-Jun-08 10:56
professionalJoe Woodbury24-Jun-08 10:56 
GeneralRe: C# locks and atomicity Pin
Judah Gabriel Himango24-Jun-08 10:59
sponsorJudah Gabriel Himango24-Jun-08 10:59 
GeneralRe: C# locks and atomicity Pin
leppie24-Jun-08 20:01
leppie24-Jun-08 20:01 
GeneralRe: C# locks and atomicity Pin
Judah Gabriel Himango25-Jun-08 5:01
sponsorJudah Gabriel Himango25-Jun-08 5:01 
GeneralRe: C# locks and atomicity Pin
Frank Horn24-Jun-08 22:36
Frank Horn24-Jun-08 22:36 
GeneralRe: C# locks and atomicity Pin
Judah Gabriel Himango25-Jun-08 5:06
sponsorJudah Gabriel Himango25-Jun-08 5:06 
GeneralRe: C# locks and atomicity Pin
Frank Horn25-Jun-08 21:30
Frank Horn25-Jun-08 21:30 
GeneralRe: C# locks and atomicity Pin
Judah Gabriel Himango26-Jun-08 5:12
sponsorJudah Gabriel Himango26-Jun-08 5:12 
GeneralRe: C# locks and atomicity Pin
Frank Horn26-Jun-08 7:50
Frank Horn26-Jun-08 7:50 
GeneralRe: C# locks and atomicity Pin
Judah Gabriel Himango26-Jun-08 8:28
sponsorJudah Gabriel Himango26-Jun-08 8:28 

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.