PDA

Click to See Complete Forum and Search --> : [2.0] Why can't I perdorm an asynchronous tasks?


dekelc
Nov 23rd, 2006, 12:51 PM
Hello you guys!!

I have a class, with a list in it, and a method to papulate that list.
I want to perform the population of the list in another thread.
to do this, I use this code:

MyClass NewClass = new MyClass();
System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(NewClass.populateList));
t.Start();


But after this, the list is still empty...
what am I doing wrong?

thanks!!

:wave:

jmcilhinney
Nov 23rd, 2006, 03:47 PM
There's no possible way to know without seeing the code for the PopulateList method. Are you sure that you are populating the same object in the worker thread that you're later testing in the UI thread?

dekelc
Nov 23rd, 2006, 04:58 PM
When I was not using the second thread, the code worked fine, and the list
was populated...

jmcilhinney
Nov 23rd, 2006, 05:40 PM
We are not telepathic. Your app does what the code tells it to do. Without the code we cannot possibly know what the issue is.

dekelc
Nov 24th, 2006, 03:41 AM
OK, I just wanted to know if I am using the second thread like I should...

The code to populate the list works, but the code to start the second thread
gives me nothing... it doesn't even step into the populateList method...