[ Nedeljko @ 25.02.2006. 12:10 ] @
Kada ispaljijem novu nit u Visual C#.NET-u, kako da jeoj prosledim neke parametre. To je moglo u MFC biblioteci. Međutim, koliko vidim, ThreadStart je delegat funkcije bez parametara.
[ kaan @ 25.02.2006. 12:34 ] @
ThreadStart-u proslijedis neku operaciju (funkciju)

Thread monitorThread = new Thread(new ThreadStart(StartMonitor));

public static void StartMonitor()
{
// implementacija
}
[ Nedeljko @ 25.02.2006. 15:40 ] @
Koliko vidim, funkcija ThreadMonitor() enema argumenata, tako da to nije odgovor na moje pitanje.

Ja bih da funkcija koja započinje izvršavanje niti primi neke parametre, recimo tri cela broja.

U MFC-u funkcija niti vraća rezultat tipa UINT i prihvata argument tipa LPVOID. Koliko vidim, ThreadStart je delegat na funkciju tipa void koja ne prihvata argumente.
[ srki @ 25.02.2006. 16:03 ] @
http://msdn.microsoft.com/libr.../html/cpconCreatingThreads.asp

Citat:
Passing Data To Threads

The ThreadStart delegate has no parameters or return value. This means that you cannot start a thread using a method that takes parameters, or obtain a return value from the method.
-To pass data to a thread, create an object to hold the data and the thread method, as shown in the two code examples that follow.
-To retrieve the results of a thread method, you can use a callback method, as demonstrated in the second code example.


Pogledaj kod na gornjem linku.