473,386 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Multithread

I'm trying to write a multithread application:

it will get different kind of data from DB, my intention was to create
different thread for each query.
I tryed to use the AsyncHelper.FireAndForget method u can easily find
on this goup but i wasn't lucky: I was able to crate threads but not to
get back results....

Any idea/modification of AsyncHelper.FireAndForget will be gratly
appreciated.

Basicly I need to call a method with parameters (array of parameters)
and get back array of sorted list or similar...

Thanks in advance.

Mar 23 '06 #1
4 3804
Take a look at the backgroundwork class. The runworkercompleted event
has a result property that allows you to return results.

(Note: this is class is new in .Net 2.0)

http://msdn2.microsoft.com/en-US/library/4852et58.aspx

--
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com

"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspx
Mar 23 '06 #2
..net 2? Try BackgroundWorker.

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"amberti" <da*************@gmail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
I'm trying to write a multithread application:

it will get different kind of data from DB, my intention was to create
different thread for each query.
I tryed to use the AsyncHelper.FireAndForget method u can easily find
on this goup but i wasn't lucky: I was able to crate threads but not to
get back results....

Any idea/modification of AsyncHelper.FireAndForget will be gratly
appreciated.

Basicly I need to call a method with parameters (array of parameters)
and get back array of sorted list or similar...

Thanks in advance.

Mar 23 '06 #3
Yes .net 2,
BackgroundWorker seems interesting but what about this:

http://www.yoda.arachsys.com/csharp/...readpool.shtml
and its
http://www.yoda.arachsys.com/csharp/miscutil/
MiscUtil.Threading.CustomThreadPool
? What's best?

Mar 23 '06 #4
I don't find Background worker all that helpful. Here is a simple pattern
you can use for just about any work:
http://channel9.msdn.com/ShowPost.aspx?PostID=171594

--
William Stacey [MVP]

"amberti" <da*************@gmail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
| I'm trying to write a multithread application:
|
| it will get different kind of data from DB, my intention was to create
| different thread for each query.
| I tryed to use the AsyncHelper.FireAndForget method u can easily find
| on this goup but i wasn't lucky: I was able to crate threads but not to
| get back results....
|
| Any idea/modification of AsyncHelper.FireAndForget will be gratly
| appreciated.
|
| Basicly I need to call a method with parameters (array of parameters)
| and get back array of sorted list or similar...
|
| Thanks in advance.
|
Apr 5 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: haptiK | last post by:
Hello, can i use php to multithread mail() or something similar? in my company i need to send multiple copies of email to a few hundred ppl affilated and on my list. instead of calling mail...
4
by: dbmethods | last post by:
Could someone give a hint on how to do multithread programming with PHP scripting here? Thanks
0
by: Alice | last post by:
Hello I have four multithread windows applications(vb.net) interacting and running on the same machine(windows 2000 with .net framework 1.0). All of them start a new thread each time Filewatcher's...
0
by: r_obert | last post by:
Hello, I'm trying to create a worker thread for my VC++ program, and was wondering whether I should be linking with the Multithread /MT or Multithread DLL /MD option? I'm not quite sure, in...
3
by: QQ | last post by:
I am new here and got lost on a multithread C++ system source codes Thanks a lot!
4
by: zbcong | last post by:
Hello: I write a multithread c# socket server,it is a winform application,there is a richtextbox control and button,when the button is click,the server begin to listen the socket port,waiting for a...
2
by: zhebincong | last post by:
Hello: I write a multithread c# socket server,it is a winform application,there is a richtextbox control and button,when the button is click,the server begin to listen the socket port,waiting...
0
by: fred | last post by:
I need some help in trying to understand how to make myCollection (inherited from CollectionBase) multithread safe. Taking my implementation of the Add Sub and a readonly property Item. Public...
6
by: jmartin | last post by:
Hi, I have made a multithread version of a program (load a file into database), and with two processors I get the double of time in the multithread than in the process (unithread) version. I...
2
by: tikcireviva | last post by:
Hi Guys, I've done a mulithread queue implementation on stl<queue>, my developement environment is on VC6 as well as FC3. Let's talks about the win32 side. The suspected memory leak is find...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.