Click here to Skip to main content
15,886,806 members
Home / Discussions / C#
   

C#

 
GeneralRe: WebClient - weird "The operation has timed out" exception. Pin
Green Fuze15-Nov-07 8:32
Green Fuze15-Nov-07 8:32 
GeneralRe: WebClient - weird "The operation has timed out" exception. Pin
led mike15-Nov-07 9:50
led mike15-Nov-07 9:50 
GeneralRe: WebClient - weird "The operation has timed out" exception. Pin
Green Fuze15-Nov-07 10:29
Green Fuze15-Nov-07 10:29 
GeneralRe: WebClient - weird "The operation has timed out" exception. Pin
led mike15-Nov-07 11:21
led mike15-Nov-07 11:21 
GeneralRe: WebClient - weird "The operation has timed out" exception. Pin
Expert Coming15-Nov-07 11:28
Expert Coming15-Nov-07 11:28 
GeneralRe: WebClient - weird "The operation has timed out" exception. Pin
Green Fuze15-Nov-07 11:35
Green Fuze15-Nov-07 11:35 
GeneralRe: WebClient - weird "The operation has timed out" exception. Pin
manach30-Sep-14 7:06
manach30-Sep-14 7:06 
QuestionC# - EventsHelper.FireAsync (async event handling in general) Pin
slikrik15-Nov-07 7:35
slikrik15-Nov-07 7:35 
Greetings,

My question is: how is using EventsHelper.FireAsync() different from using EventsHelper.Fire() BUT having the listener's event handler spawn a new thread to do the work?

In my program, I have a data feed coming in and I have a separate form that has a DataGridView on it. Each time a message comes in (they come in very rapidly) I fire an event and the handler (which exists on the DataGridView's form) adds a row to the DataGridView.

Approach #1: use EventsHelper.FireAsync() to fire the events as they come in. This is nice because the slowness of adding rows to the DataGridView control doesn't slow down the incoming data feed AT ALL -- meaning, if there were other listeners to this event, their performance wouldn't suffer from the slow DataGridView. HOWEVER, this approach doesn't work because of the asynchronous nature, the rows aren't necessarily added in order (message 3 might be processed/added to the DataGridView before messages 1 and 2).

Approach #2: use EventsHelper.Fire() (the synchronous version), and in the event handler, spawn a BackgroundWorker that adds the message to the DataGridView. I don't like this approach because then EVERY handler of this event is going to have to do all this extra work, but I figured it was the only way I could ensure the messages (events) would be received in order. However what I noticed is this approach (spawning the BackgroundWorker thread) doesn't really give a speed improvement over simply doing ALL the work in the same event thread.

Why isn't approach #2, with a BackgroundWorker in the ONLY event handler as fast as approach #1?

I love the speed EventsHelper.FireAsync provides, but I need to maintain order of the events. If anyone has any advice, I'm all ears.

Thanks in advance!

RL
AnswerRe: C# - EventsHelper.FireAsync (async event handling in general) Pin
Judah Gabriel Himango15-Nov-07 9:28
sponsorJudah Gabriel Himango15-Nov-07 9:28 
QuestionFile & FileInfo Pin
half-life15-Nov-07 6:07
half-life15-Nov-07 6:07 
AnswerRe: File & FileInfo Pin
Albu Marius15-Nov-07 6:14
Albu Marius15-Nov-07 6:14 
GeneralRe: File & FileInfo Pin
half-life15-Nov-07 6:40
half-life15-Nov-07 6:40 
QuestionVisual Studio 2005 Standard Edition Pin
Khoramdin15-Nov-07 6:04
Khoramdin15-Nov-07 6:04 
AnswerRe: Visual Studio 2005 Standard Edition Pin
led mike15-Nov-07 6:07
led mike15-Nov-07 6:07 
GeneralRe: Visual Studio 2005 Standard Edition Pin
Albu Marius15-Nov-07 6:10
Albu Marius15-Nov-07 6:10 
AnswerRe: Visual Studio 2005 Standard Edition Pin
Khoramdin15-Nov-07 6:48
Khoramdin15-Nov-07 6:48 
GeneralRe: Visual Studio 2005 Standard Edition Pin
led mike15-Nov-07 7:09
led mike15-Nov-07 7:09 
GeneralRe: Visual Studio 2005 Standard Edition Pin
Khoramdin15-Nov-07 10:10
Khoramdin15-Nov-07 10:10 
GeneralRe: Visual Studio 2005 Standard Edition Pin
Dave Kreskowiak15-Nov-07 7:28
mveDave Kreskowiak15-Nov-07 7:28 
GeneralRe: Visual Studio 2005 Standard Edition Pin
Khoramdin15-Nov-07 10:11
Khoramdin15-Nov-07 10:11 
Questionhow to connect hardware device Pin
cs.it.tech15-Nov-07 5:10
cs.it.tech15-Nov-07 5:10 
AnswerRe: how to connect hardware device Pin
Dave Kreskowiak15-Nov-07 7:30
mveDave Kreskowiak15-Nov-07 7:30 
GeneralRe: how to connect hardware device Pin
cs.it.tech15-Nov-07 8:39
cs.it.tech15-Nov-07 8:39 
GeneralRe: how to connect hardware device Pin
Dan Neely15-Nov-07 8:57
Dan Neely15-Nov-07 8:57 
GeneralRe: how to connect hardware device Pin
Dave Kreskowiak15-Nov-07 10:51
mveDave Kreskowiak15-Nov-07 10:51 

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.