Looking for ThreadEx examples

  • Thread starter Thread starter jayderk
  • Start date Start date
J

jayderk

I am looking for some examples on using the ThreadEx class.

I could not find any out on openNetCF.org...

regards,
Jay
 
Any example for the desktop Thread class applies. Are you looking for
something specific?

-Chris
 
I am looking for a CF example that starts when the main form starts but runs
seperately and does not affect the UI after it is started.. until the app is
shut down of course.

regards,
Jay
 
jayderk said:
I am looking for a CF example that starts when the main form starts but runs
seperately and does not affect the UI after it is started.. until the app is
shut down of course.

Well, you don't need ThreadEx for that - what do you think you need
beyond what Thread normally gives you?

Note that there's no such thing as a background thread in the Compact
Framework (v1) so you'll need to make your secondary thread poll for
when it should shut down.
 
I want to incorporate the openNETCF into my app because of all of the
extended features so I really want it to be examples of ThreadEx.
do you know of any out there?


regards,
Jay
 
jayderk said:
I want to incorporate the openNETCF into my app because of all of the
extended features

Which ones are you particularly interested in though? What are you
having trouble with?
so I really want it to be examples of ThreadEx.
do you know of any out there?

No, but it looks like you can just use it as you would a normal thread
on the desktop framework.

What have you tried, and what problems have you run into?
 
Thanks for your quick response.

I am having an issue with my form starting a thread in a new class(non-ui) I
created the class but am having trouble with how to call it from form class.

regards,
Jay
 
Hello Jon,

Thanks for all of your help but I got it. I was not starting the thread
correctly.

myThread = new Utility.myThread();
ThreadStart agent = new ThreadStart(myThread.pollThread);
agentThread = new ThreadEx(agent);
agentThread.Start();


public class myThread
{


public SatThread()
{
//
// TODO: Add constructor logic here
//
threadIsRunning = true;
}

private bool threadIsRunning; //class variable



public void pollThread()
{
Console.WriteLine("Thread Polling started");
while(threadIsRunning)
{
Console.WriteLine(DateTime.Now.ToString());
System.Threading.Thread.Sleep(2000);
}
Console.WriteLine("Thread Polling stopped");
}

public void stopThread()
{
threadIsRunning = false;
}

}
 
Back
Top