Re: .net 2.0 : looking for a "best practice" for multi threading jobs
- From: "Steve B." <steve_beauge@xxxxxxxxxxxx>
- Date: Mon, 26 Feb 2007 11:11:09 +0100
Thanks for your answer.
When I talked about whole data in a DataSet, I mean whole CONTROL data... ie
downloaded files, location of file ont the disk or current progression of an
action.
The link you provided is very interesting. I'll take a deep look but I'm
quite sure by now that the Monitor.Pulse will solve my problem .
Thanks very much !
Steve
"Michael Nemtsev" <nemtsev@xxxxxxx> a écrit dans le message de news:
1799a79b3d745c8c925a4aeaed6ee@xxxxxxxxxxxxxxxxxxxxxxx
Hello Steve B.,
S> I'm building an application that follow this scenario.
S> 1. Download a file on a server with http
S> 2. Analyse this file and extract other files in one of the section of
S> the
S> file (like dependent files)
S> 3. Foreach found files, repeat the whole process.
S> The question is : how can I quickly and correctly design my code to
S> have my winform dynamic, and the pool of working threads?
S> My first reflexion was to store the whole data in a DataSet (easy
S> databinding) which can be flat (only on DataTable required).
so, you keep serialized objects?! why not to just save files on your
drive?
S> I also created an abstract class "BaseAction" that is inherited by
S> two classes : "DownloadAction" and "AnalyseAction".
S> My process object defines a Queue<Action> where I add all required
S> actions.
S> But I'm confused for the next steps... how can I have multiples
S> trheads that can "Dequeue" actions? moreover, I don't know how to
manage the
S> multiples threeads since sometimes I'll have only one item in te queue,
and
S> this item can add new items...
You can use ThreadPool class (standard .net) or Produce/consummer pattern
http://www.yoda.arachsys.com/csharp/threads/threadpool.shtml
http://groups.google.ru/group/microsoft.public.dotnet.framework/browse_thread/thread/a33378c87b856678/abc251c95cbac487
The idea is that you can dequeue your files and each tread will analyze
your files dequeuing them
---
WBR, Michael Nemtsev [C# MVP]. My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
.
- References:
- .net 2.0 : looking for a "best practice" for multi threading jobs
- From: Steve B.
- Re: .net 2.0 : looking for a "best practice" for multi threading jobs
- From: Michael Nemtsev
- .net 2.0 : looking for a "best practice" for multi threading jobs
- Prev by Date: BACKPROPCONTROLLib.dll
- Next by Date: problem in first web form application
- Previous by thread: Re: .net 2.0 : looking for a "best practice" for multi threading jobs
- Next by thread: Re: .net 2.0 : looking for a "best practice" for multi threading jobs
- Index(es):
Loading