diff -ruN klic-3.003-2002-02-25/runtime/asyncio.c klic-3.003-2002-02-25a/runtime/asyncio.c
--- klic-3.003-2002-02-25/runtime/asyncio.c	Fri Feb 22 11:41:09 2002
+++ klic-3.003-2002-02-25a/runtime/asyncio.c	Mon Feb 25 12:02:30 2002
@@ -5,6 +5,7 @@
 %       (Read COPYRIGHT-JIPDEC for detailed information.)
 ----------------------------------------------------------- */
 
+#include <assert.h>
 #include <klic/basic.h>  /* fatal, klic_fprintf */
 #include <klic/struct.h>
 #include <klic/unify.h>
@@ -37,7 +38,7 @@
 static fd_set sigio_infds;
 static fd_set sigio_outfds;
 static enum sigiotype* sigio_types;
-static int (**sigio_handlers)();
+static sigio_t* sigio_handlers;
 static struct timeval zerotime = { 0, 0 };
 
 /* This function may be called from itimer interrupt handler */
@@ -59,26 +60,24 @@
     if (retry_sigio_type != KLIC_SIGIO_NONE) {
       int fd = retry_fd;
       int again;
-      set_heapp(allocp);
-      again = (sigio_handlers[fd])(allocp, fd, retry_sigio_type, &fdsr, &fdsw);
+      assert(allocp == heapp());
+      again = sigio_handlers[fd](fd, retry_sigio_type, &fdsr, &fdsw);
       allocp = heapp();
       if (again)
 	return 1;
-      allocp = heapp();
+      assert(allocp == heapp());
       retry_sigio_type = KLIC_SIGIO_NONE;
     }
     fdsr = sigio_infds;
     fdsw = sigio_outfds;
     r = select(fd_setsize, &fdsr, &fdsw, 0, &zerotime);
-    {
-	if (debugger_flag) {
-	    int fd;
-	    char buffer[100];
-	    fd = open("/dev/pts/2", 1);
-	    sprintf(buffer, "%d:r=%d %08x\n", my_node, r, *(int*) &fdsr);
-	    write(fd, buffer, strlen(buffer));
-	    close(fd);
-	}
+    if (debugger_flag) {
+      int fd;
+      char buffer[100];
+      fd = open("/dev/pts/2", 1);
+      sprintf(buffer, "%d:r=%d %08x\n", my_node, r, *(int*) &fdsr);
+      write(fd, buffer, strlen(buffer));
+      close(fd);
     }
 
     if (r > 0) {
@@ -115,25 +114,25 @@
 	    default:
 	      continue;
 	    }
-	    set_heapp(allocp);
-	    again = sigio_handlers[fd](allocp, fd, call_type, &fdsr, &fdsw);
+	    assert(allocp == heapp());
+	    again = sigio_handlers[fd](fd, call_type, &fdsr, &fdsw);
 	    allocp = heapp();
 	    if (again) {
 	      retry_fd = fd;
 	      retry_sigio_type = call_type;
 	      return 1;
 	    }
-	    allocp = heapp();
+	    assert(allocp == heapp());
 	}
     }
-    set_heapp(allocp);
+    assert(allocp == heapp());
     return 0;
 }
 
 extern void
 add_sigio_handler(fd, func, sigio_type)
   long fd;
-  int (*func)();
+  sigio_t func;
   enum sigiotype sigio_type;
 {
     sigio_handlers[fd] = func;
@@ -179,7 +178,7 @@
 #endif /* USEGETDTABLESIZE */
   sigio_types =
     (enum sigiotype*) malloc_check(sizeof(enum sigiotype) * fd_setsize);
-  sigio_handlers = (int(**)()) malloc_check(sizeof(int (*)()) * fd_setsize);
+  sigio_handlers = (sigio_t*) malloc_check(sizeof(sigio_t) * fd_setsize);
   for (k = 0; k < fd_setsize; ++k) {
       sigio_handlers[k] = NULL;
       sigio_types[k] = KLIC_SIGIO_NONE;
@@ -194,26 +193,24 @@
 
 #ifdef ASYNCIO
 static int
-send_ready_message(allocp, fd, sigio_type, rfd, wfd)
-     q* allocp;
+send_ready_message(fd, sigio_type, rfd, wfd)
      long fd;
      enum sigiotype sigio_type;
      fd_set *rfd, *wfd;
 {
   declare_globals;
   q* array = asyncio_streams;
-  set_heapp(allocp);
   if (array[fd] == 0) {
     klic_fprintf(stderr, "Unexpected IO interrupt for fd %d ignored\n", fd);
   } else {
+    q* allocp = heapp();
     q newcons = makecons(allocp);
     q newvar = allocp[0] = makeref(&allocp[0]);
     allocp[1] = makeint(fd);
     allocp += 2;
-    allocp = do_unify_value(allocp, array[fd], newcons);
+    set_heapp (do_unify_value (allocp, array[fd], newcons));
     array[fd] = newvar;
   }
-  set_heapp(allocp);
   return 0;
 }
 
diff -ruN klic-3.003-2002-02-25/runtime/asyncio.h klic-3.003-2002-02-25a/runtime/asyncio.h
--- klic-3.003-2002-02-25/runtime/asyncio.h	Fri Dec 28 13:46:47 2001
+++ klic-3.003-2002-02-25a/runtime/asyncio.h	Mon Feb 25 12:02:53 2002
@@ -8,6 +8,8 @@
 #ifndef _KLIC_ASYNCIO_H_
 #define _KLIC_ASYNCIO_H_
 
+#include <sys/types.h>  /* fd_set */
+
 enum sigiotype {
   KLIC_SIGIO_NONE,
   KLIC_SIGIO_IN,
@@ -15,8 +17,10 @@
   KLIC_SIGIO_INOUT
 };
 
+typedef int (*sigio_t)(long fd, enum sigiotype, fd_set* rfd, fd_set* wfd);
+
 /* runtime/asyncio.c */
-extern void add_sigio_handler(long fd, int (*func)(), enum sigiotype sigio_type);
+extern void add_sigio_handler(long fd, sigio_t func, enum sigiotype sigio_type);
 extern void init_sigio_handler(void);
 extern void init_asynchronous_io(void);
 extern void close_asynchronous_io_stream(long fd);
diff -ruN klic-3.003-2002-02-25/runtime/config/pvm-tcp/distpkt.c klic-3.003-2002-02-25a/runtime/config/pvm-tcp/distpkt.c
--- klic-3.003-2002-02-25/runtime/config/pvm-tcp/distpkt.c	Mon Feb 18 16:46:27 2002
+++ klic-3.003-2002-02-25a/runtime/config/pvm-tcp/distpkt.c	Mon Feb 25 12:02:30 2002
@@ -442,8 +442,7 @@
     }
 }
 static int
-dist_sigio_stream_handler(allocp, fd, sigio_type, rfd, wfd)
-q *allocp;
+dist_sigio_stream_handler(fd, sigio_type, rfd, wfd)
 long fd;
 enum sigiotype sigio_type;
 fd_set *rfd, *wfd;
@@ -454,7 +453,7 @@
     for (i = 0; i < tid_table.child_count; ++i)
       if (i != my_node)
 	FD_CLR(port_tbl[i].fd, rfd);
-    return receive_message(allocp, SIGIO);
+    return receive_message(heapp(), SIGIO);
 }
 
 int debugger_flag;
