class Program
{
public static void childthreadcall()
{
Console.WriteLine("child thread started");
}
static void Main(string[] args)
{
ThreadStart ch = new ThreadStart(childthreadcall);
Console.WriteLine("main-creating child thread");
Thread childthread = new Thread(ch);
childthread.Start();
Console.WriteLine("main-have requested the start of child thread");
Console.ReadLine();
}
}
if i execute this code i got
main-creating child thread
main-have requested the start of child thread
child thread started
if i execute line-by-line by pressing f10
main-creating child thread
child thread started
main-have requested the start of child thread
can anyone explain me?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Use
childthread.Join();
afterchildthread.Start();
in main-thread to await the completion of a new thread