TAPE: Fix potential race (Coverity)
This commit is contained in:
parent
fae6a18835
commit
8baac06f7f
1 changed files with 10 additions and 1 deletions
11
sim_tape.c
11
sim_tape.c
|
@ -322,10 +322,19 @@ sim_debug (ctx->dbit, ctx->dptr, "_tape_completion_dispatch(unit=%d, top=%d, cal
|
||||||
if (ctx->io_top != TOP_DONE)
|
if (ctx->io_top != TOP_DONE)
|
||||||
abort(); /* horribly wrong, stop */
|
abort(); /* horribly wrong, stop */
|
||||||
|
|
||||||
if (ctx->callback && ctx->io_top == TOP_DONE) {
|
if (ctx->asynch_io)
|
||||||
|
pthread_mutex_lock (&ctx->io_lock);
|
||||||
|
|
||||||
|
if (ctx->callback) {
|
||||||
ctx->callback = NULL;
|
ctx->callback = NULL;
|
||||||
|
if (ctx->asynch_io)
|
||||||
|
pthread_mutex_unlock (&ctx->io_lock);
|
||||||
callback (uptr, ctx->io_status);
|
callback (uptr, ctx->io_status);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (ctx->asynch_io)
|
||||||
|
pthread_mutex_unlock (&ctx->io_lock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static t_bool _tape_is_active (UNIT *uptr)
|
static t_bool _tape_is_active (UNIT *uptr)
|
||||||
|
|
Loading…
Add table
Reference in a new issue