C
C# Learner
I keep seeing code like this in tutorials:
public void Start()
{
Thread thread = new Thread(new ThreadStart(Callback));
thread.IsBackground = true;
thread.Start();
}
This seems erroneous to me. Surely thread is then subject to garbage
collection, since it has a reference count of 0 after execution leaves
this method.
Am I missing something here?
public void Start()
{
Thread thread = new Thread(new ThreadStart(Callback));
thread.IsBackground = true;
thread.Start();
}
This seems erroneous to me. Surely thread is then subject to garbage
collection, since it has a reference count of 0 after execution leaves
this method.
Am I missing something here?