diff --git a/cmdline/io.c b/cmdline/io.c index 6c7a7c6e..370629e9 100644 --- a/cmdline/io.c +++ b/cmdline/io.c @@ -605,12 +605,12 @@ static struct snapraid_task* io_task_read_thread(struct snapraid_io* io, unsigne task = &worker->task_map[io->reader_index]; - thread_mutex_unlock(&io->io_mutex); - /* mark the worker as processed */ /* setting the previous one to point at the next one */ *let = io->reader_list[i + 1]; + thread_mutex_unlock(&io->io_mutex); + /* return the position */ *pos = i - base; @@ -691,12 +691,12 @@ static void io_parity_write_thread(struct snapraid_io* io, unsigned* pos, unsign /* if the worker has finished this index */ if (busy_index != worker->index) { - thread_mutex_unlock(&io->io_mutex); - /* mark the worker as processed */ /* setting the previous one to point at the next one */ *let = io->writer_list[i + 1]; + thread_mutex_unlock(&io->io_mutex); + /* return the position */ *pos = i;