diff options
Diffstat (limited to 'libvxi11client/libvxi11client.c')
-rw-r--r-- | libvxi11client/libvxi11client.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libvxi11client/libvxi11client.c b/libvxi11client/libvxi11client.c index b212487..e33cb24 100644 --- a/libvxi11client/libvxi11client.c +++ b/libvxi11client/libvxi11client.c @@ -28,6 +28,7 @@ static CLIENT* abortclnt = NULL; static Device_Link link; static GThread* interruptthread; static bool interruptchannelopen = false; +static void (*interruptcallback)(void) = NULL; static void killinterruptthreadandwait() { #ifdef DEBUG @@ -43,6 +44,11 @@ device_intr_srq_1_svc(Device_SrqParms *argp, struct svc_req *rqstp) { #ifdef DEBUG printf("device_intr_srq_1_svc()\n"); #endif + + if (interruptcallback != NULL) { + interruptcallback(); + } + static char * result; return (void *) &result; } @@ -474,7 +480,7 @@ int vxi11_destroy_intr_chan() { * enable interrupts */ -int vxi11_enable_srq(bool enable, char* handle) { +int vxi11_enable_srq(bool enable, char* handle, void (*callback)(void)) { if (!interruptchannelopen) return 0; else if (clnt == NULL) @@ -483,9 +489,16 @@ int vxi11_enable_srq(bool enable, char* handle) { return 0; Device_EnableSrqParms params = { .lid = link, .enable = enable }; - if (handle != NULL) { - params.handle.handle_val = handle; - params.handle.handle_len = strlen(handle); + if (enable) { + if (handle != NULL) { + params.handle.handle_val = handle; + params.handle.handle_len = strlen(handle); + } + interruptcallback = callback; + } + else { + params.handle.handle_val = NULL; + params.handle.handle_len = 0; } Device_Error* error = device_enable_srq_1(¶ms, clnt); if (error != NULL && error->error == 0) { |