I got it!!! I needed an External and a args.Data() for the function
template and it all works!!! Perfect! YOU ARE THE GOD!! THANKS SO MUCH!
On Wednesday, May 24, 2017 at 1:52:51 AM UTC+2, Patrik Laszlo wrote:
>
> Hi!
>
> How are you?
> This works, async function:
>
> static void WorkAsync(uv_work_t *req) {
> Work *work = static_cast<Work *>(req->data);
>
> int i = 0;
> while(work->running) {
> //sleep(1);
> usleep(1000 * 1000 * 0.25);
> cout << i++ << endl;
> }
> work->result = "Async task processed.";
> }
>
>
>
> I can return in my addon, a cancel callback. Callad CancelFunction.
> I would like to set work->running = false, so it stops computing.
> But with FunctionTempalte. I cannot give a pointer :) How can I do it?
>
> Local<FunctionTemplate> tpl = FunctionTemplate::New(isolate, CancelFunction);
> Local<Function> fn = tpl->GetFunction();
>
>
> I can work it, by I cannot pass a pointer to the work . Is it easy?
>
> Thanks so much!
> Bye!
>
--
--
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.