home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / amiga / programm / 13026 < prev    next >
Encoding:
Internet Message Format  |  1992-09-02  |  3.9 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsc!cbfsb!att-out!pacbell.com!iggy.GW.Vitalink.COM!cs.widener.edu!dsinc!bagate!cbmvax!cbmehq!cbmger!edohwg!heinz
  2. From: heinz@edohwg.UUCP (Heinz Wrobel)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Debugging a filesystem handler...
  5. Message-ID: <heinz.03by@edohwg.UUCP>
  6. Date: 1 Sep 92 19:35:16 GMT
  7. References: <1992Aug31.061928.18053@softway.sw.oz.au>
  8. Organization: Edotronik GmbH
  9. Lines: 86
  10.  
  11. In article <1992Aug31.061928.18053@softway.sw.oz.au> peterc@suite.sw.oz.au (Peter Chubb) writes:
  12. >Does anyone know why this no longer works?
  13.  
  14. You may not startup directly or indirectly other handlers before you reply
  15. to your startup packet with V37. Maybe that's the problem.
  16.  
  17. I forward this info to help:
  18.  
  19. >debatz@obsmeu.UUCP (B. de Batz) writes:
  20. >>I have a strange problem, related, I think, with some new semaphore
  21. >>in 2.x
  22. >
  23. >     Yup.
  24. >
  25. >>I am writing a handler, and in order to debug it, I create, into it, a process
  26. >>(following an old M. Dillon example) with CreateProc() .
  27. >>In this process I open a debugging window with
  28. >>
  29. >> fh = Open("CON:0/0/640/100/debugwindow", MODE_NEWFILE);
  30. >
  31. >     You cannot do an access which starts another handler until you reply
  32. >your initial packet.  Of course, once you reply the initial packet you may
  33. >get packets coming into your msgport, so it's not safe after that either.
  34. >(The reason for the semaphore was to stop the old "two copies of ram: get
  35. >started if you're quick" bug.)
  36. >
  37. >     The solution is that there are 2 new globvec types (1 for BCPL-style
  38. >handlers (globvec = -3), 1 for C-style handlers (globvec = -2)).  These
  39. >don't grab the semaphore, but they require that your handler use forbid-locking
  40. >around the setting of dol_Task.  If you don't set dol_Task, there's no
  41. >problem.  The locking required is:
  42. >
  43. >     Forbid();
  44. >     if (dev->dol_Task == NULL)
  45. >         dev->dol_Task = MyMsgPort;
  46. >     else
  47. >         // handler already started, return packet with success
  48. >         // and then exit!
  49. >     endif
  50. >     Permit();
  51. >
  52. >     NOTE: under 1.3, dos didn't look at dol_Task if it started the process,
  53. >it assumed if the packet succeeded that the process message port was what to
  54. >send to.  This means that under 1.3 you must just either set dol_Task
  55. >regardless of any value already there, or fail the startup packet if dol_Task
  56. >is set already.
  57. >
  58. >     There is another (>= 2.04) solution:  If you set dp_Arg4 (yes, put
  59. >a return value in an arg), it will use that for the message port to send to.
  60. >The "what message port to send to" algorithm is basically this:
  61. >
  62. >/* use either port passed back in arg4 or dol_Task (if set) */
  63. >/* This allows handlers to keep their process port for sync */
  64. >/* Dos I/O.                             */
  65. >
  66. >     if (pkt->dp_Arg4)
  67. >         task = (struct MsgPort *) pkt->dp_Arg4;
  68. >     else if (node->dol_Task)
  69. >         task = node->dol_Task;
  70. >     else
  71. >         task = &(process->pr_MsgPort);
  72. >
  73. >     Once again, the dp_Arg4 trick will not work in <V37.  It's primarily
  74. >useful for handlers that do not set dol_Task (such as console and port
  75. >handlers), so that they can do normal synchronous dos IO inside their handler
  76. >(though be careful of that semaphore before your reply the startup message...)
  77. >
  78. >--
  79. >A Novice asked the master: "What is the true meaning of programming?"  The
  80. >master replied: "Eat when you are hungry, sleep when you are tired, program
  81. >when the moment is right."  - The Zen of Programming
  82. >-
  83. >Randell Jesup, Jack-of-quite-a-few-trades, Commodore Engineering.
  84. >{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup
  85. >Disclaimer: Nothing I say is anything other than my personal opinion.
  86.  
  87.  
  88. >                - Peter Chubb
  89.  
  90. --
  91. Heinz Wrobel, Edotronik GmbH (ECG018)
  92. FAX +49 89 850 51 25 / TEL +49 89 850 25 20 (HOME!&VOICE, sometimes...)
  93. Path: cbmehq!cbmger!edohwg!heinz@cbmvax.commodore.com
  94. "It's good to have a mouse, it's faster if you can do without one..."
  95. "He who doesn't develop with an A2024 doesn't know about font independent
  96.  user interfaces..."
  97.