Multi threading
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 649
- Joined: Mon Dec 09, 2013 6:37 pm
Multi threading
Is it possible to execute a function thats defined in a shared script in a separate thread from the main thread in Verj IO ?
0 x
-
- Moderator
- Posts: 419
- Joined: Fri Sep 07, 2007 3:44 pm
- Location: Sandy, UK
- Contact:
Re: Multi threading
Hi Segi,
You cannot run a shared script in a separate Thread, but can certainly define a separate thread to run in your script.
Something like this:
The example above shows how to spawn a new Thread. Note that you override the run() method with a defined function().
I hope this answers your question.
Kind regards
Steve
You cannot run a shared script in a separate Thread, but can certainly define a separate thread to run in your script.
Something like this:
Code: Select all
var thread = new java.lang.Thread(
function () {
for(var x =0; x<10; x++)
{
log("\nrunning : " + java.lang.Thread.currentThread().getName());
java.lang.Thread.sleep(1000);
}
}
);
thread.start();
I hope this answers your question.
Kind regards
Steve
0 x
-
- Ebase User
- Posts: 649
- Joined: Mon Dec 09, 2013 6:37 pm
Re: Multi threading
Steve,
That's exactly what I am trying to do. I have a function in client callable functions that I want to run in a separate thread
When using $eb.executeFunctionAsynchronously doesn't that do the same kind of thing where it runs the function asynchronously by running in a separate thread ?
That's exactly what I am trying to do. I have a function in client callable functions that I want to run in a separate thread
When using $eb.executeFunctionAsynchronously doesn't that do the same kind of thing where it runs the function asynchronously by running in a separate thread ?
0 x
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
Re: Multi threading
When you use $eb.executeFunctionAsynchronously(), you're executing the function on the server and it will run in a separate thread anyway, you don't have to do anything to make this happen.
I think we may be at cross purposes here. Could you say a bit more about exactly what you're trying to do.
I think we may be at cross purposes here. Could you say a bit more about exactly what you're trying to do.
0 x
Who is online
Users browsing this forum: No registered users and 7 guests