Event Driven Code and Thread Control
- From: "Brad Walton" <newsgroups@xxxxxxxxxxxxxxxx>
- Date: Sun, 18 May 2008 01:16:45 -0700
Hello. First post, but been doing a bit of reading here. I am working on a project in Java, but decided to switch over to C# after seeing some of the additional features I can get from C#. One of the big changes I want to make is event-driven code (rather than the linear flow I had in Java). I have spent a week or so searching Google, talking to a couple of programming friends, and just chewing on it in my brain. I think I have an ok handle on delegates (new to me), but I'm still having some issues and could use some help to push me along in the right direction.
Here is a quick run-down of the program (well, what I had in mind anyway). There is a GUI thread, a main processing thread (handles parsing, updating the objects, etc - this could also been on the GUI thread, but not sure if that is proper design. This would basically be the worker thread where all the data is actually manipulated), and 2 input threads (1 socket reading from another application, and 1 file also reading from that same other application). Both the input threads will be reading data that will affect the same objects (although most updates will not be of the same attributes). I'd like for the 2 input threads to fire events at the main processing thread when they get information. I'd like for that information to be placed onto the main processing thread when received by it. I'd also like for this to happen 'instantly' and not use a queue on a timer check (something I was doing in the Java linear version).
So that's basically where I'm at with it. I have searched Google for c# info on 'event-driven code', 'delegate marshal thread', etc to try and put this all together, but I'm not really finding the answers I need. Most of the marshal information relates to placing it back onto a UI thread (which could work, but again not sure if that would be good design), not a specified thread. And this is where I could really use some help. Can I marshal to a thread I specify? If so, are there any examples, tutorials, etc?
Any help is greatly appreciated.
Brad
.
- Follow-Ups:
- Re: Event Driven Code and Thread Control
- From: Peter Duniho
- Re: Event Driven Code and Thread Control
- From: Lasse Vågsæther Karlsen
- Re: Event Driven Code and Thread Control
- From: Cor Ligthert[MVP]
- Re: Event Driven Code and Thread Control
- Prev by Date: Re: Creating wizards in C#
- Next by Date: Re: Event Driven Code and Thread Control
- Previous by thread: Reverse Loop?
- Next by thread: Re: Event Driven Code and Thread Control
- Index(es):
Relevant Pages
|