mirror of
https://github.com/simh/simh.git
synced 2026-02-10 02:01:05 +00:00
TAPE: Fix potential race (Coverity)
This commit is contained in:
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user