diff --git a/scp.c b/scp.c index e0736cd1..d0578584 100644 --- a/scp.c +++ b/scp.c @@ -10790,7 +10790,7 @@ return _sim_activate_after_abs (uptr, usec_delay); t_stat _sim_activate_after_abs (UNIT *uptr, double usec_delay) { -AIO_VALIDATE; /* Can't call asynchronously */ +AIO_VALIDATE(uptr); /* Can't call asynchronously */ sim_cancel (uptr); return _sim_activate_after (uptr, usec_delay); } @@ -10807,8 +10807,8 @@ return _sim_activate_after (uptr, usec_delay); t_stat _sim_activate_after (UNIT *uptr, double usec_delay) { -AIO_VALIDATE; /* Can't call asynchronously */ -if (sim_is_active (uptr)) /* already active? */ +AIO_VALIDATE(uptr); /* Can't call asynchronously */ +if (sim_is_active (uptr)) /* already active? */ return SCPE_OK; return sim_timer_activate_after (uptr, usec_delay); } @@ -10826,7 +10826,7 @@ t_stat sim_cancel (UNIT *uptr) { UNIT *cptr, *nptr; -AIO_VALIDATE; +AIO_VALIDATE(uptr); if ((uptr->cancel) && uptr->cancel (uptr)) return SCPE_OK; if (uptr->dynflags & UNIT_TMR_UNIT) @@ -10881,7 +10881,7 @@ return SCPE_OK; t_bool sim_is_active (UNIT *uptr) { -AIO_VALIDATE; +AIO_VALIDATE(uptr); AIO_UPDATE_QUEUE; return (((uptr->next) || AIO_IS_ACTIVE(uptr) || ((uptr->dynflags & UNIT_TMR_UNIT) ? sim_timer_is_active (uptr) : FALSE)) ? TRUE : FALSE); } @@ -10917,7 +10917,7 @@ int32 sim_activate_time (UNIT *uptr) { int32 accum; -AIO_VALIDATE; +AIO_VALIDATE(uptr); accum = _sim_timer_activate_time (uptr); if (accum >= 0) return accum; @@ -10930,7 +10930,7 @@ UNIT *cptr; int32 accum; double result; -AIO_VALIDATE; +AIO_VALIDATE(uptr); result = sim_timer_activate_time_usecs (uptr); if (result >= 0) return result; diff --git a/sim_defs.h b/sim_defs.h index fc9293c9..834bcf97 100644 --- a/sim_defs.h +++ b/sim_defs.h @@ -1256,7 +1256,12 @@ extern int32 sim_asynch_inst_latency; return SCPE_OK; \ } else (void)0 #endif /* USE_AIO_INTRINSICS */ -#define AIO_VALIDATE if (!pthread_equal ( pthread_self(), sim_asynch_main_threadid )) {sim_printf("Improper thread context for operation in %s line %d\n", __FILE__, __LINE__); abort();} +#define AIO_VALIDATE(uptr) \ + if (!pthread_equal ( pthread_self(), sim_asynch_main_threadid )) { \ + sim_printf("Improper thread context for operation on %s in %s line %d\n", \ + sim_uname(uptr), __FILE__, __LINE__); \ + abort(); \ + } else (void)0 #define AIO_CHECK_EVENT \ if (0 > --sim_asynch_check) { \ AIO_UPDATE_QUEUE; \ @@ -1272,7 +1277,7 @@ extern int32 sim_asynch_inst_latency; #define AIO_QUEUE_MODE "Asynchronous I/O is not available" #define AIO_UPDATE_QUEUE #define AIO_ACTIVATE(caller, uptr, event_time) -#define AIO_VALIDATE +#define AIO_VALIDATE(uptr) #define AIO_CHECK_EVENT #define AIO_INIT #define AIO_MAIN_THREAD TRUE diff --git a/sim_disk.c b/sim_disk.c index 91076565..66a62e92 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -1996,7 +1996,7 @@ if (!(uptr->flags & UNIT_ATT)) /* attached? */ sim_debug_unit (ctx->dbit, uptr, "sim_disk_reset(unit=%d)\n", (int)(uptr-ctx->dptr->units)); _sim_disk_io_flush(uptr); -AIO_VALIDATE; +AIO_VALIDATE(uptr); AIO_UPDATE_QUEUE; return SCPE_OK; } diff --git a/sim_tape.c b/sim_tape.c index bc52bd23..3bbd2275 100644 --- a/sim_tape.c +++ b/sim_tape.c @@ -2439,7 +2439,7 @@ if (ctx == NULL) /* if not properly attac sim_debug_unit (ctx->dbit, uptr, "sim_tape_reset(unit=%d)\n", (int)(uptr-ctx->dptr->units)); _sim_tape_io_flush(uptr); -AIO_VALIDATE; +AIO_VALIDATE(uptr); AIO_UPDATE_QUEUE; return SCPE_OK; } diff --git a/sim_timer.c b/sim_timer.c index 0e99f746..d31979bf 100644 --- a/sim_timer.c +++ b/sim_timer.c @@ -2508,7 +2508,7 @@ return inst_per_sec; t_stat sim_timer_activate (UNIT *uptr, int32 interval) { -AIO_VALIDATE; +AIO_VALIDATE(uptr); return sim_timer_activate_after (uptr, (double)((interval * 1000000.0) / sim_timer_inst_per_sec ())); } @@ -2519,7 +2519,7 @@ int inst_delay, tmr; double inst_delay_d, inst_per_usec; t_stat stat; -AIO_VALIDATE; +AIO_VALIDATE(uptr); /* If this is a clock unit, we need to schedule the related timer unit instead */ for (tmr=0; tmr<=SIM_NTIMERS; tmr++) if (sim_clock_unit[tmr] == uptr) { diff --git a/sim_tmxr.c b/sim_tmxr.c index 1e8f027c..29cd88d5 100644 --- a/sim_tmxr.c +++ b/sim_tmxr.c @@ -4260,7 +4260,7 @@ return _sim_activate (uptr, interval); t_stat tmxr_activate_abs (UNIT *uptr, int32 interval) { -AIO_VALIDATE; /* Can't call asynchronously */ +AIO_VALIDATE(uptr); /* Can't call asynchronously */ sim_cancel (uptr); return tmxr_activate (uptr, interval); }