0
I was thinking of creating thread one in my software, but I saw through the forums that the Runnable
help in a certain way in creating a thread, and wanted to understand how it works.
0
I was thinking of creating thread one in my software, but I saw through the forums that the Runnable
help in a certain way in creating a thread, and wanted to understand how it works.
4
I don’t know anything about Runnable
in C#, this is a Java thing. This class was required by a deficiency at the beginning of the language.
Even the use of thread is considered outdated in C#. Of course it can be used, but the ideal, whenever possible, that is adequate, and almost always is, prefer to use Task
, which will choose to create/use threads internal if necessary.
If you want to insist on it, take a look at ThreadStart
.
Browser other questions tagged java c# .net thread
You are not signed in. Login or sign up in order to post.
In fact, what is this Runnable and why we don’t have in C#?
– CypherPotato
Probably because you don’t have to, you have better mechanisms.
– Maniero
Runnable
is an interface that forces to implement a method without parameters that does not return anything, this method by chance is calledrun()
and contains the code to be effectively executed by the thread, so it is passed to the classThread
trigger thread execution on the operating system. For convenience the Thread class also implements the Runnable interface and can itself contain the code in question (actually a subclass of it).– Piovezan