Hi I was wondering if there was a way of calling a function/method (preferably in Python or Java) and continue execution without waiting for it.
Example:
def a():
b() #call a function, b()
return "something"
def b():
#something that takes a really long time
Run it in a new thread. Learn about multithreading in java here and python multithreading here
Java example:
new Thread() {
public void run() {
YourFunction();//Call your function
}
}.start();
Runnable myrunnable = new Runnable() {
public void run() {
YourFunction();//Call your function
}
}
new Thread(myrunnable).start();//Call it when you need to run the function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With