/* begincopyright Copyright (c) 1988 Xerox Corporation. All rights reserved. Use and copying of this software and preparation of derivative works based upon this software are permitted. Any distribution of this software or derivative works must comply with all applicable United States export control laws. This software is made available AS IS, and Xerox Corporation makes no warranty about the software, its performance or its conformity to any specification. Any person obtaining a copy of this software is requested to send their name and post office or electronic mail address to: PCR Coordinator Xerox PARC 3333 Coyote Hill Rd. Palo Alto, CA 94304 endcopyright */ /* * ThreadsUIOINTEvent.c * * This is a clone of ThreadsUIOEvents.c that supports SIGINT * CHauser September 12, 1991 5:18:33 pm PDT */ #ifndef _XR_THREADS_ # include "xr/Threads.h" #endif #ifndef _XR_THREADS_BACKDOOR_ # include "xr/ThreadsBackdoor.h" #endif #ifndef _XR_UIO_ # include "xr/UIO.h" #endif #ifndef _XR_UIO_PRIVATE_ # include "xr/UIOPrivate.h" #endif #ifndef _XR_UIO_EVENTS_ # include "xr/UIOEvents.h" #endif #ifndef _XR_ERRNO_ # include "xr/Errno.h" #endif #include extern struct XR_MLRep XR_iopUIOEventLock; extern struct XR_CVRep XR_iopUIOEventAvail; int XR_UIORegisterInterestInINTEvent(interested) bool interested; { struct XR_IOPOrderRep iopo; XR_IOPOResult result; int ans; XR_IOPE iope; XR_IOPE iopeLimit = XR_UIOIOPELimit; XR_MonitorEntry(&XR_iopUIOEventLock); for( iope = XR_uioArea->uioa_iope; iope < iopeLimit; iope++ ) { iopo.iopo_eventSigNum = SIGINT; iopo.iopo_eventInteresting = interested; result = XR_IssueIOPOrder( /* iop */ iope, /* order */ &iopo, /* proc */ XR_RegisterInterestIOPOrderProc, /* cancel */ NIL, /* abortable */ FALSE, /* timeout */ XR_WAIT_FOREVER ); if( result != XR_IOPO_RESULT_OK ) { XR_MonitorExit(&XR_iopUIOEventLock); XR_SetErrno(EIO); return (-1); } ans = (int)(iopo.iopo_results[0]); if( ans < 0 ) { XR_MonitorExit(&XR_iopUIOEventLock); if( interested ) (void) XR_UIORegisterInterestInINTEvent(FALSE); XR_SetErrno(-ans); return (-1); } } XR_MonitorExit(&XR_iopUIOEventLock); return 0; }