mika-fischer/napi-thread-safe-callback

example_async_work within class

Closed this issue · 1 comments

Hi,

I've been looking for a thread-safe implementation for a while, thanks for this!

I've tried copy pasting the example_async_work into my code (c++ and js), but I can't get the callback to work,

It enters the thread but the callback never gets called.

The only difference with your code is that I've made the function part of a class instead of being standalone.

If I run your tests they work fine, so I'm not sure what the issue is.

Nope, nothing wrong with your code, I was just doing something stupid in the main thread of js which was blocking the callback.