Help with threads/delegates

  • Thread starter Thread starter SamIAm
  • Start date Start date
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
 
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.
 
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
 
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.
 
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.
 
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
 
Back
Top