static void _monitor_command_wait_done(struct monitor_command *cmd, int polling)
{
+ mtx_lock(&cmd->lock);
while (!cmd->done) {
smp_rmb();
if (polling-- <= 0) {
- mtx_lock(&cmd->lock);
cnd_wait(&cmd->signal, &cmd->lock);
- mtx_unlock(&cmd->lock);
- /* done at this time */
- break;
}
}
+ mtx_unlock(&cmd->lock);
}
void monitor_command_wait_done(struct monitor_command *cmd)
struct monitor *monitor = data;
struct monitor_command *cmd;
+ mtx_lock(&monitor->lock);
new_command:
if (dequeue(monitor->q, (void *)&cmd) < 0) {
if (empty_counter++ > MONITOR_POLLING_DURATION) {
empty_counter = 0;
- mtx_lock(&monitor->lock);
cnd_wait(&monitor->signal, &monitor->lock);
- mtx_unlock(&monitor->lock);
goto new_command;
}
+ mtx_unlock(&monitor->lock);
return THREAD_RETURN_CONTINUE;
}
+ mtx_unlock(&monitor->lock);
syscommon_resman_monitor_update_resource_attrs(cmd->resource_id);