Fixed bugs in disk and tape operations when running without asynch disabled - bugs reported by Jordi Guillaumes i Pons
This commit is contained in:
parent
df4cc945bb
commit
7e1840eb5f
2 changed files with 28 additions and 14 deletions
21
sim_disk.c
21
sim_disk.c
|
@ -239,19 +239,26 @@ static t_bool _disk_is_active (UNIT *uptr)
|
|||
{
|
||||
struct disk_context *ctx = (struct disk_context *)uptr->disk_ctx;
|
||||
|
||||
sim_debug (ctx->dbit, ctx->dptr, "_disk_is_active(unit=%d, dop=%d)\n", uptr-ctx->dptr->units, ctx->io_dop);
|
||||
return (ctx->io_dop != DOP_DONE);
|
||||
if (ctx) {
|
||||
sim_debug (ctx->dbit, ctx->dptr, "_disk_is_active(unit=%d, dop=%d)\n", uptr-ctx->dptr->units, ctx->io_dop);
|
||||
return (ctx->io_dop != DOP_DONE);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void _disk_cancel (UNIT *uptr)
|
||||
{
|
||||
struct disk_context *ctx = (struct disk_context *)uptr->disk_ctx;
|
||||
|
||||
sim_debug (ctx->dbit, ctx->dptr, "_disk_cancel(unit=%d, dop=%d)\n", uptr-ctx->dptr->units, ctx->io_dop);
|
||||
pthread_mutex_lock (&ctx->io_lock);
|
||||
while (ctx->io_dop != DOP_DONE)
|
||||
pthread_cond_wait (&ctx->io_done, &ctx->io_lock);
|
||||
pthread_mutex_unlock (&ctx->io_lock);
|
||||
if (ctx) {
|
||||
sim_debug (ctx->dbit, ctx->dptr, "_disk_cancel(unit=%d, dop=%d)\n", uptr-ctx->dptr->units, ctx->io_dop);
|
||||
if (ctx->asynch_io) {
|
||||
pthread_mutex_lock (&ctx->io_lock);
|
||||
while (ctx->io_dop != DOP_DONE)
|
||||
pthread_cond_wait (&ctx->io_done, &ctx->io_lock);
|
||||
pthread_mutex_unlock (&ctx->io_lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define AIO_CALLSETUP
|
||||
|
|
21
sim_tape.c
21
sim_tape.c
|
@ -314,19 +314,26 @@ static t_bool _tape_is_active (UNIT *uptr)
|
|||
{
|
||||
struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx;
|
||||
|
||||
sim_debug (ctx->dbit, ctx->dptr, "_tape_is_active(unit=%d, top=%d)\n", uptr-ctx->dptr->units, ctx->io_top);
|
||||
return (ctx->io_top != TOP_DONE);
|
||||
if (ctx) {
|
||||
sim_debug (ctx->dbit, ctx->dptr, "_tape_is_active(unit=%d, top=%d)\n", uptr-ctx->dptr->units, ctx->io_top);
|
||||
return (ctx->io_top != TOP_DONE);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void _tape_cancel (UNIT *uptr)
|
||||
{
|
||||
struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx;
|
||||
|
||||
sim_debug (ctx->dbit, ctx->dptr, "_tape_cancel(unit=%d, top=%d)\n", uptr-ctx->dptr->units, ctx->io_top);
|
||||
pthread_mutex_lock (&ctx->io_lock);
|
||||
while (ctx->io_top != TOP_DONE)
|
||||
pthread_cond_wait (&ctx->io_done, &ctx->io_lock);
|
||||
pthread_mutex_unlock (&ctx->io_lock);
|
||||
if (ctx) {
|
||||
sim_debug (ctx->dbit, ctx->dptr, "_tape_cancel(unit=%d, top=%d)\n", uptr-ctx->dptr->units, ctx->io_top);
|
||||
if (ctx->asynch_io) {
|
||||
pthread_mutex_lock (&ctx->io_lock);
|
||||
while (ctx->io_top != TOP_DONE)
|
||||
pthread_cond_wait (&ctx->io_done, &ctx->io_lock);
|
||||
pthread_mutex_unlock (&ctx->io_lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define AIO_CALLSETUP
|
||||
|
|
Loading…
Add table
Reference in a new issue