htsmsg_add_str(msg, "__op__", op);
HTSMSG_FOREACH(f, uuids) {
if (!(uuid = htsmsg_field_get_string(f))) continue;
- if (!(in = idnode_find(uuid, NULL, domain))) continue;
- domain = in->in_domain;
- if (idnode_perm(in, perm, msg)) {
- pcnt++;
- continue;
+ pthread_mutex_lock(&global_lock);
+ if ((in = idnode_find(uuid, NULL, domain)) != NULL) {
+ domain = in->in_domain;
+ if (idnode_perm(in, perm, msg)) {
+ pcnt++;
+ continue;
+ }
+ handler(perm, in);
+ if (!destroyed)
+ idnode_perm_unset(in);
+ cnt++;
}
- handler(perm, in);
- if (!destroyed)
- idnode_perm_unset(in);
- cnt++;
+ pthread_mutex_unlock(&global_lock);
+ if (destroyed)
+ pthread_yield(); /* delete penalty */
}
htsmsg_destroy(msg);
/* Single */
} else {
uuid = htsmsg_field_get_string(f);
+ pthread_mutex_lock(&global_lock);
if (!(in = idnode_find(uuid, NULL, NULL))) {
err = ENOENT;
} else {
}
htsmsg_destroy(msg);
}
+ pthread_mutex_unlock(&global_lock);
}
- pthread_mutex_unlock(&global_lock);
return err;
}