From a14a1ab5cd87edc64d17947f84eeae023e474061 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Wed, 4 Apr 2012 11:08:56 -0700 Subject: [PATCH] Added missing synchronization when dispatching asynchronous calls. From Sergey Oboguev --- sim_tape.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sim_tape.c b/sim_tape.c index 2878c08e..8c4d7bce 100644 --- a/sim_tape.c +++ b/sim_tape.c @@ -151,6 +151,7 @@ if ((!callback) || !ctx->asynch_io) struct tape_context *ctx = \ (struct tape_context *)uptr->tape_ctx; \ \ + pthread_mutex_lock (&ctx->io_lock); \ \ sim_debug (ctx->dbit, ctx->dptr, \ "sim_tape AIO_CALL(op=%d, unit=%d)\n", op, uptr-ctx->dptr->units);\ @@ -168,6 +169,7 @@ if ((!callback) || !ctx->asynch_io) ctx->objupdate = _obj; \ ctx->callback = _callback; \ pthread_cond_signal (&ctx->io_cond); \ + pthread_mutex_unlock (&ctx->io_lock); \ } \ else \ if (_callback) \