0
Hello, I wanted to know how to run one thread after another for a certain time, for example:
Thread x = new Thread(() -> {
// qualquer código, pode ter até um while(true)...
});
Thread x2 = new Thread(() -> {
// qualquer código, pode ter até um while(true)...
});
I have a thread x that should run for 3s, after which it should pause and then x2 should start, but it cannot contain any additional code within its runnable. Thank you in advance.
Do you want to use threads for synchronous tasks? Why?
– Woss
Because I have to execute several independent codes in a certain period of time, like I want x seconds to run a code snippet, but that goes back to where it left off. I don’t know if I made it clear :/
– V. Azzone
@V.Azzone I couldn’t understand it very well. I suggest you edit your question and provide more details of what you want to do.
– Piovezan