+void call_error_cb(meshlink_handle_t *mesh, meshlink_errno_t meshlink_errno) {
+ // We should only call the callback function if we are in the background thread.
+ if(!mesh->error_cb) {
+ return;
+ }
+
+ if(!mesh->threadstarted) {
+ return;
+ }
+
+ if(mesh->thread == pthread_self()) {
+ mesh->error_cb(mesh, meshlink_errno);
+ }
+}
+
+