summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaniel <danieruru@gmail.com>2013-01-30 13:28:33 +0900
committerdaniel <danieruru@gmail.com>2013-01-30 13:28:33 +0900
commit4494ecb71854bbb625aba18a637c7e8529939735 (patch)
treee91b370168cc31f4579340e673665bb3bd9c3cc5
parent7931456d6aab98df25e92eb217a77eeea0c5b0fb (diff)
Make wait for interrupt more useful
-rw-r--r--libvxi11client/perlbits/Client.xs4
-rw-r--r--libvxi11client/perlbits/perlglue.c7
-rw-r--r--libvxi11client/perlbits/perlglue.h2
3 files changed, 8 insertions, 5 deletions
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 <perl.h>
#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();