mirror of
https://github.com/open-simh/simh.git
synced 2026-05-04 23:25:46 +00:00
Fixed bugs in disk and tape operations when running without asynch disabled - bugs reported by Jordi Guillaumes i Pons
This commit is contained in:
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;
|
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);
|
if (ctx) {
|
||||||
return (ctx->io_dop != DOP_DONE);
|
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)
|
static void _disk_cancel (UNIT *uptr)
|
||||||
{
|
{
|
||||||
struct disk_context *ctx = (struct disk_context *)uptr->disk_ctx;
|
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);
|
if (ctx) {
|
||||||
pthread_mutex_lock (&ctx->io_lock);
|
sim_debug (ctx->dbit, ctx->dptr, "_disk_cancel(unit=%d, dop=%d)\n", uptr-ctx->dptr->units, ctx->io_dop);
|
||||||
while (ctx->io_dop != DOP_DONE)
|
if (ctx->asynch_io) {
|
||||||
pthread_cond_wait (&ctx->io_done, &ctx->io_lock);
|
pthread_mutex_lock (&ctx->io_lock);
|
||||||
pthread_mutex_unlock (&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
|
#else
|
||||||
#define AIO_CALLSETUP
|
#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;
|
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);
|
if (ctx) {
|
||||||
return (ctx->io_top != TOP_DONE);
|
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)
|
static void _tape_cancel (UNIT *uptr)
|
||||||
{
|
{
|
||||||
struct tape_context *ctx = (struct tape_context *)uptr->tape_ctx;
|
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);
|
if (ctx) {
|
||||||
pthread_mutex_lock (&ctx->io_lock);
|
sim_debug (ctx->dbit, ctx->dptr, "_tape_cancel(unit=%d, top=%d)\n", uptr-ctx->dptr->units, ctx->io_top);
|
||||||
while (ctx->io_top != TOP_DONE)
|
if (ctx->asynch_io) {
|
||||||
pthread_cond_wait (&ctx->io_done, &ctx->io_lock);
|
pthread_mutex_lock (&ctx->io_lock);
|
||||||
pthread_mutex_unlock (&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
|
#else
|
||||||
#define AIO_CALLSETUP
|
#define AIO_CALLSETUP
|
||||||
|
|||||||
Reference in New Issue
Block a user