473,394 Members | 1,866 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,394 software developers and data experts.

ThreadPool help

Hi there,

I'm not an experienced C# user so I would like to ask for some help
'cause I get actually lost. Here it goes. I'm trying to use the
'ThreadPool.QueueUserWorkItem()' method in order to create a new
thread and passing through some arguments on a Data Container
class(StoreArguments class). Despite that (theorically perfect) fact,
I have some problems on taking it to the practice.
I do the following:

void Main(...)
{
ThreadPool.QueueUserWorkItem( new WaitCallback(StoreProcess),
storeArgs );
}
Nov 16 '05 #1
1 1499
Carmelo <ca*********@yahoo.com> wrote:
I'm not an experienced C# user so I would like to ask for some help
'cause I get actually lost. Here it goes. I'm trying to use the
'ThreadPool.QueueUserWorkItem()' method in order to create a new
thread and passing through some arguments on a Data Container
class(StoreArguments class). Despite that (theorically perfect) fact,
I have some problems on taking it to the practice.
I do the following:

void Main(...)
{
ThreadPool.QueueUserWorkItem( new WaitCallback(StoreProcess),
storeArgs );
}
.
.
.
private void StoreProcess( StoreArguments storeArgs )
{...}

Then when I compile appears the next error:
Method 'StoreProcess(StoreArguments)' does not match delegate 'void
System.Threading.WaitCallback(object)'

Anyone knows why it happen or whats wrong with my code?


Exactly what the compiler says - your StoreProcess arguments don't
match those specified by WaitCallback. You need to change it to
something like:

private void StoreProcess (object state)
{
StoreArguments storeArgs = (StoreArguments)state;
}

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2

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

Similar topics

5
by: Dan Battagin | last post by:
Is there a known bug with the interaction between the HttpWebRequest and the ThreadPool? I current spawn several HttpWebRequest's using BeginGetResponse, and they work for a while, using worker...
4
by: David Levine | last post by:
Jon, I've taken a look at it and these comments are based on a code-inspection but I did not verify the correctness if its operation by using it in a sample. The ctor for CustomThreadPool...
5
by: Duane Pressley | last post by:
I'm looking for someone to help me make sense of the results I'm observing when using the ThreadPool class in a COM-Interop scenario. Here's the set up: 1.. A classic ASP page instantiates and calls...
3
by: SSonnenwald | last post by:
I have created a piece of code that uses a ThreadPool class and the QueueUserWorkItem method to add items to the the ThreadPool. What would seem to be simple I just can not figure out how to tell...
1
by: doudou-shen | last post by:
I will use threadpool do some work with threadpool . but I haven't any information about it . who can help me! thank a lot
8
by: mabra | last post by:
Hi All ! Sorry, I could not find it :-( If the threadpool would be per application domain, I could just create another AppDomain to get another ThreadPool there. Alternately, I would have to...
1
by: Angelo | last post by:
Ok, I am utilizing the threadpool class to manage a number of threads. Priority is not important to me and neither is if the threads are background or foreground threads so I opted for the...
5
by: =?Utf-8?B?RkxEYXZlTQ==?= | last post by:
I'm developing an application that gets data from 100 sources (via telnet connections, but you can think stock quotes from a webservice if you like). I was planning on using the thread pool (25...
3
by: UltimateBanoffee | last post by:
Hi, I'm using asp.net 2.0 and I have an understanding issue here! I don't quite understand when the available threads in the ThreadPool are ever used. The application I have running doesn't use...
6
by: Ricardo Vazquez | last post by:
Hello everybody, I'm programming a TCP server. During the stress tests I noticed that maybe my socket-receiving thread became deaf after an hour of heavy stress. I think that the reason could...
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: 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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.