Help with threads/delegates

S

SamIAm

Hi There

I have a method called MyMethod in Class MyClass. Whenever MyMethod is
called I want to fire off a new thread to call another method called
MyEventMethod. I want to fire this method off on a new thread as I don't
want to wait for it to finish processing before returning to my calling app.
How should I do this? Here is some sample code:


public class MyClass
{
public MyClass()
{
}

public void MyMethod(int Param1, int Param2)
{
// Do something
}

public void MyEventMethod(int Param1, int Param2)
{
// Do something
}
}

Thanks,

S
 
J

Joey Powell

I would also be very interested in seeing some sample code on how to
do this - nothing fancy. Just enough to get the job done.
 
K

Kieran Benton

Me three :)

Is there any way of implementing something like an .Invoke in a thread ive
created? So that one thread can get another thread to call a method in its
time?

Thanks
Kieran
 
K

Kieran Benton

Dave,
Any useful resources/links?

Thanks again

Dave said:
If it's a UI thread with controls then you can use Control.Invoke. If it's a
worker thread with no UI then you will need to implement your own signalling
mechanism.
 
D

Dave

Not any that I could easily find via google. I think I might write a little
class that provides that functionality...it seems to be a common enough
request.
 
K

Kieran Benton

That would be pretty cool. Im pretty savvy in all things C# but im jsut
learning the intracacies of threading and getting very muddled up :) could i
see what your working on and maybe contribute?

Thanks
Kieran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top