nan icon indicating copy to clipboard operation
nan copied to clipboard

Support Isolate::RunMicrotasks

Open romgrk opened this issue 4 years ago • 4 comments

Was merged with MicrotaskQueue::RunMicrotasks:

https://github.com/v8/v8/commit/ba363c755b14d8d81313509b797f421226bc4ea1

romgrk avatar May 25 '21 21:05 romgrk

@romgrk What exactly are you looking for here? The change you linked is not an API change.

addaleax avatar May 26 '21 08:05 addaleax

Wdym by not an API change? It was previously Isolate::RunMicrotasks, it's now Isolate::PerformMicrotaskCheckpoint. Something like Nan::RunMicrotasks() would be nice.

#if V8_MAJOR_VERSION >= 9
    Isolate::GetCurrent()->PerformMicrotaskCheckpoint();
#else
    Isolate::GetCurrent()->RunMicrotasks();
#endif

romgrk avatar May 26 '21 11:05 romgrk

@romgrk Could it be that you’re thinking about a different V8 commit then? Only changes to include/ are relevant for Node.js addons.

That being said – Node.js addons should generally not run the microtask queue manually, because Node.js itself manages it. Do you have a specific use case in mind?

addaleax avatar May 26 '21 13:05 addaleax

@romgrk Could it be that you’re thinking about a different V8 commit then? Only changes to include/ are relevant for Node.js addons.

Ok, not that's the commit I'm thinking about, not sure how you classify what goes in or not but I was under the impression that this was for anything that needs to be specialized for different V8 versions.

That being said – Node.js addons should generally not run the microtask queue manually, because Node.js itself manages it. Do you have a specific use case in mind?

I know, but my addon isn't like most of them :| I need to stop nodejs event loop to replace it with GTK's event loop and call uv_run from within it. Very unconventional and has bad implications for how things work, but there are no easy solutions to the root issue.

But anyway, this is quite small and I understand it's a very rare use-case, I can live with doing the check in my codebase, you can close if you don't plan to include it.

romgrk avatar May 26 '21 17:05 romgrk