meshlink_handle_t *mesh = xzalloc(size);
mesh->confbase = xstrdup(confbase);
mesh->appname = xstrdup(appname);
- mesh->dclass = dclass;
+ mesh->devclass = devclass;
if (usingname) mesh->name = xstrdup(name);
- pthread_mutex_init ( &(mesh->nodes_mutex), NULL);
+
+ // initialize mutex
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&(mesh->mesh_mutex), &attr);
+
mesh->threadstarted = false;
event_loop_init(&mesh->loop);
mesh->loop.data = mesh;