mirror of
https://github.com/open-simh/simh.git
synced 2026-04-26 04:07:23 +00:00
- Changed asynch queue insertion and removal to use a lock free algorithm based only on InterlockedCompareExchangePointer. We can now use this lock free approach on IA64 host systems as well.
- Removed flawed logic which assumed that sim_interval was meaningful when referenced by an asynchronous thread. - Adjust the event_time of events removed from the asynch queue to account for the average time spent on the queue before the event was noticed by the instruction execution thread. - Added a sim_activate_notbefore function which specifies an rtime which is the earliest time the event should fire. - Changed the 'wakeup from idle' logic to force an immediate asynch queue check if the wakeup was not due to a timeout (i.e. it was due to an asynch queue insertion). - Fixed the descrip.mms to build asynchronous support on AXP and IA64 VMS with kernel threads enabled
This commit is contained in:
30
scp.c
30
scp.c
@@ -1961,17 +1961,17 @@ for (uptr = sim_clock_queue; uptr != NULL; uptr = uptr->next) {
|
||||
#if defined (SIM_ASYNCH_IO)
|
||||
pthread_mutex_lock (&sim_asynch_lock);
|
||||
fprintf (st, "asynchronous pending event queue\n");
|
||||
if (sim_asynch_queue == (void *)-1)
|
||||
if (sim_asynch_queue == AIO_LIST_END)
|
||||
fprintf (st, "Empty\n");
|
||||
else {
|
||||
for (uptr = sim_asynch_queue; uptr != (void *)-1; uptr = uptr->a_next) {
|
||||
for (uptr = sim_asynch_queue; uptr != AIO_LIST_END; uptr = uptr->a_next) {
|
||||
if ((dptr = find_dev_from_unit (uptr)) != NULL) {
|
||||
fprintf (st, " %s", sim_dname (dptr));
|
||||
if (dptr->numunits > 1) fprintf (st, " unit %d",
|
||||
(int32) (uptr - dptr->units));
|
||||
}
|
||||
else fprintf (st, " Unknown");
|
||||
fprintf (st, " event delay %d, queue time %d\n", uptr->a_event_time, uptr->a_sim_interval);
|
||||
fprintf (st, " event delay %d\n", uptr->a_event_time);
|
||||
}
|
||||
}
|
||||
fprintf (st, "asynch latency: %d nanoseconds\n", sim_asynch_latency);
|
||||
@@ -4914,6 +4914,30 @@ sim_cancel (uptr);
|
||||
return sim_activate (uptr, event_time);
|
||||
}
|
||||
|
||||
/* sim_activate_notbefore - activate (queue) event even if event already scheduled
|
||||
but not before the specified time
|
||||
|
||||
Inputs:
|
||||
uptr = pointer to unit
|
||||
rtime = relative timeout
|
||||
Outputs:
|
||||
reason = result (SCPE_OK if ok)
|
||||
*/
|
||||
|
||||
t_stat sim_activate_notbefore (UNIT *uptr, int32 rtime)
|
||||
{
|
||||
uint32 rtimenow, urtime = (uint32)rtime;
|
||||
|
||||
AIO_ACTIVATE (sim_activate_notbefore, uptr, rtime);
|
||||
sim_cancel (uptr);
|
||||
rtimenow = sim_grtime();
|
||||
sim_cancel (uptr);
|
||||
if (0x80000000 <= urtime-rtimenow)
|
||||
return sim_activate (uptr, 0);
|
||||
else
|
||||
return sim_activate (uptr, urtime-rtimenow);
|
||||
}
|
||||
|
||||
/* sim_cancel - cancel (dequeue) event
|
||||
|
||||
Inputs:
|
||||
|
||||
Reference in New Issue
Block a user