From 4494ecb71854bbb625aba18a637c7e8529939735 Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 30 Jan 2013 13:28:33 +0900 Subject: Make wait for interrupt more useful --- libvxi11client/perlbits/Client.xs | 4 ++-- libvxi11client/perlbits/perlglue.c | 7 +++++-- libvxi11client/perlbits/perlglue.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'libvxi11client/perlbits') diff --git a/libvxi11client/perlbits/Client.xs b/libvxi11client/perlbits/Client.xs index 1ad34e9..2727077 100644 --- a/libvxi11client/perlbits/Client.xs +++ b/libvxi11client/perlbits/Client.xs @@ -93,8 +93,8 @@ vxi_enable_srq_long(context, enable, handle) RETVAL char* -vxi_wait_for_interrupt(timeout = 0) - unsigned int timeout +vxi_wait_for_interrupt(timeout = 250) + int timeout CODE: RETVAL = glue_wait_for_interrupt(timeout); OUTPUT: diff --git a/libvxi11client/perlbits/perlglue.c b/libvxi11client/perlbits/perlglue.c index 5c6448b..096f7a7 100644 --- a/libvxi11client/perlbits/perlglue.c +++ b/libvxi11client/perlbits/perlglue.c @@ -64,7 +64,7 @@ int glue_stop_interrupt_server() { return ret; } -char* glue_wait_for_interrupt(unsigned int timeout) { +char* glue_wait_for_interrupt(int timeout) { if (interruptqueue == NULL ) { #ifdef DEBUG printf("interrupt queue is null!\n"); @@ -82,7 +82,10 @@ char* glue_wait_for_interrupt(unsigned int timeout) { g_time_val_add(&whentotimeout, timeout * 1000); lastevent = (Event*) g_async_queue_timed_pop(interruptqueue, &whentotimeout); } - else { + else if (timeout == 0) { + lastevent = (Event*) g_async_queue_try_pop(interruptqueue); + } + else if (timeout == -1) { lastevent = (Event*) g_async_queue_pop(interruptqueue); } diff --git a/libvxi11client/perlbits/perlglue.h b/libvxi11client/perlbits/perlglue.h index 1b29567..3f9c1cc 100644 --- a/libvxi11client/perlbits/perlglue.h +++ b/libvxi11client/perlbits/perlglue.h @@ -2,7 +2,7 @@ #include #include "libvxi11client.h" -char* glue_wait_for_interrupt(); +char* glue_wait_for_interrupt(int timeout); VXI11Context* glue_open(char* address, char* device); int glue_start_interrupt_server(); int glue_stop_interrupt_server(); -- cgit