MCPcopy Index your code
hub / github.com/nodejs/node-addon-api / entryWithTSFN

Function entryWithTSFN

test/threadsafe_function/threadsafe_function_sum.cc:42–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40 */
41
42void entryWithTSFN(ThreadSafeFunction tsfn, int threadId) {
43 std::this_thread::sleep_for(std::chrono::milliseconds(std::rand() % 100 + 1));
44 tsfn.BlockingCall([=](Napi::Env env, Function callback) {
45 callback.Call({Number::New(env, static_cast<double>(threadId))});
46 });
47 tsfn.Release();
48}
49
50static Value TestWithTSFN(const CallbackInfo& info) {
51 int threadCount = info[0].As<Number>().Int32Value();

Callers

nothing calls this directly

Calls 3

BlockingCallMethod · 0.80
CallMethod · 0.80
ReleaseMethod · 0.45

Tested by

no test coverage detected