1: # include "../../pipes.h" 2: # include "../../ingres.h" 3: # include "IIglobals.h" 4: 5: /* 6: ** RESYNCHRONIZE PIPES AFTER AN INTERRUPT 7: ** 8: ** The pipes are all cleared out. This routines must be called 9: ** by all processes in the system simultaneously. It should be 10: ** called from the interrupt catching routine. 11: ** 12: ** History: 13: ** 11/2/79 -- (marc) added IIeinpipe PRIME to get rid 14: ** of old data from the pipe which was being read 15: ** in the retrieve after the interrupt. 16: */ 17: 18: extern exit(); 19: int (*IIinterrupt)() = &exit; 20: IIresync() 21: { 22: struct pipfrmt buf; 23: register struct pipfrmt *pbuf; 24: extern struct pipfrmt IIeinpipe; 25: 26: signal(2,1); 27: pbuf = &buf; 28: IIwrpipe(P_PRIME, pbuf, 0, 0, 0); 29: /* write the sync block out */ 30: IIwrpipe(P_INT, pbuf, IIw_down); 31: 32: /* read the sync block back on both pipes */ 33: /* must be in right order */ 34: IIrdpipe(P_INT, pbuf, IIr_front); 35: IIrdpipe(P_INT, pbuf, IIr_down); 36: 37: /* flush remaining old data from buffer */ 38: IIrdpipe(P_PRIME, &IIeinpipe, 0, 0, 0); 39: 40: /* Get out of a retrieve and clear errors */ 41: IIin_retrieve = 0; 42: IIerrflag = 0; 43: IIndomains = IIdomains = 0; 44: 45: 46: /* reset the signal */ 47: signal(2,&IIresync); 48: /* allow the user to service the interrupt */ 49: (*IIinterrupt)(-1); 50: /* 51: ** If IIinterupt returns the user might hang in a retrieve 52: */ 53: 54: IIsyserr("Interupt returned"); 55: }