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

Method OnWorkProgress

napi-inl.h:6832–6859  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6830
6831template <class T>
6832inline void AsyncProgressWorker<T>::OnWorkProgress(void*) {
6833 T* data;
6834 size_t size;
6835 bool signaled;
6836 {
6837 std::lock_guard<std::mutex> lock(this->_mutex);
6838 data = this->_asyncdata;
6839 size = this->_asyncsize;
6840 signaled = this->_signaled;
6841 this->_asyncdata = nullptr;
6842 this->_asyncsize = 0;
6843 this->_signaled = false;
6844 }
6845
6846 /**
6847 * The callback of ThreadSafeFunction is not been invoked immediately on the
6848 * callback of uv_async_t (uv io poll), rather the callback of TSFN is
6849 * invoked on the right next uv idle callback. There are chances that during
6850 * the deferring the signal of uv_async_t is been sent again, i.e. potential
6851 * not coalesced two calls of the TSFN callback.
6852 */
6853 if (data == nullptr && !signaled) {
6854 return;
6855 }
6856
6857 this->OnProgress(data, size);
6858 delete[] data;
6859}
6860
6861template <class T>
6862inline void AsyncProgressWorker<T>::SendProgress_(const T* data, size_t count) {

Callers 1

OnAsyncWorkProgressMethod · 0.80

Calls 1

OnProgressMethod · 0.45

Tested by

no test coverage detected