home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 4 / CDPD_IV.bin / networking / dnet / dnet2.3.2 / amiga / lib / waitmsg.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-29  |  900 b   |  49 lines

  1. /* WaitMsg.c
  2. ** 
  3. ** an attempt to recreate the WaitMsg function
  4. ** which might have been a normal system call back in the original 
  5. ** days of DNet, but which is not now...
  6. */
  7.  
  8. #include <exec/nodes.h>
  9. #include <exec/io.h>
  10.  
  11. typedef struct IORequest IOR;
  12. typedef struct IOStdReq IOSTD;
  13.  
  14. #ifdef  DEBUG
  15. #include <stdio.h>
  16. #define IFDEBUG(foo) foo
  17. #else
  18. #define IFDEBUG(foo) 
  19. #endif
  20.  
  21. #define FOO
  22.  
  23.  
  24. WaitMsg( IOSTD * ior){
  25. #ifdef FOO
  26.    unsigned long waitmask;
  27. #endif FOO
  28.  
  29.    IFDEBUG(printf("WaitMsg enter\n");)
  30.  
  31. #ifdef FOO
  32.  
  33.    if(ior == NULL) return;
  34.  
  35.    waitmask = 1L << (ior -> io_Message . mn_ReplyPort -> mp_SigBit);
  36.  
  37. waitsomemore:
  38.    Wait(waitmask);
  39.  
  40.    if(!CheckIO((IOR *)ior)){
  41.     IFDEBUG(printf("Wait returned, but we should wait some more\n");)
  42.        goto waitsomemore;
  43.    }
  44. #endif /* FOO */
  45.  
  46.    WaitIO((IOR *) ior); /* deal with all the annoying reply crap */
  47.    IFDEBUG(printf("WaitMsg exit\n");)
  48. }
  49.