title: How to use napi_threadsafe_function for NodeJS Native Addon
body: <p>I've been looking through the <a href="https://nodejs.org/api/n-api.html#napi_call_threadsafe_function" rel="noreferrer">NAPI documentation</a> to try and understand how it deals with <code>multithreading</code>. According to the documentation <code>napi_create_threadsafe_function()</code> and <code>napi_call_threadsafe_function()</code> are used to create and call <code>js functions</code> from multiple threads. The issue is that the documentation is not that straight forward, and there are no examples and I can't find any anywhere else.</p>
  
  <p>If anyone has any experience using <code>napi_create_threadsafe_function()</code> and <code>napi_call_threadsafe_function()</code> or know where to find examples of them being used. Please if you could help out with a a basic example so I can just understand how to use them correctly. </p>
  
  <p>I'm writting a <code>C</code> addon not <code>C++</code> and need to use these functions. I am not using the wrapper <code>node-addon-api</code>, but <code>napi</code> directly</p>