Quick question, the answer is eluding me on the internet. Which is unusual.

When we reference and call a sub/function from a class is it automatically started on a new thread or will it join the main thread?

Cheers in advance.

Recommended Answers

All 3 Replies

It runs in the curreent thread.


Edit: is that also true if we start new instance of that class?

yes. If you want it in another thread then you have to specifically create a new thread, then start a new instance of the class from within that new thread. New threads are never ever started all by themselves, you have to do it yourself.

Read this article and this about how to create a thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.