home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / amiga / programm / 18443 < prev    next >
Encoding:
Internet Message Format  |  1993-01-10  |  2.0 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!ub!rutgers!cbmvax!cbmehq!cbmger!edohwg!heinz
  2. From: heinz@edohwg.adsp.sub.org (Heinz Wrobel)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Enough talk.  FILE: server.c
  5. Message-ID: <heinz.060l@edohwg.adsp.sub.org>
  6. Date: 8 Jan 93 19:20:39 GMT
  7. References: <C0IyF5.9Gv@usenet.ucs.indiana.edu>
  8. Organization: Edotronik GmbH
  9. Lines: 44
  10.  
  11. In article <C0IyF5.9Gv@usenet.ucs.indiana.edu> shulick@navajo.ucs.indiana.edu (Sam Hulick) writes:
  12. >   Forbid();
  13. >   myport = FindPort("Foobar!");  /*Is the server already running..? */
  14. >   Permit();
  15.  
  16. You shouldn't Permit() here. You delay it depending on myport until after
  17. AddPort() or some other server could get in your way.
  18.  
  19. >   while (!done) {
  20. >      WaitPort(myport); /* Wait for an incoming message. */
  21. >      while ((msg = (struct FooMsg *)GetMsg(myport)))  /* Got one...! */
  22. >      {
  23.  
  24. Hmm. There is no ReplyMsg() or FreeMem or any cleanup like that for msg!
  25.  
  26. >         if (!(win = (struct Window *)OpenWindow(&newwin)))
  27. >         {
  28. >        Alert(AN_OpenWindow);
  29. >        exit(0);
  30.  
  31. Hmmm. You quit without even trying to clean up behind yourself. Not nice.
  32. Leaves lots of memory and a non functional port around.
  33.  
  34. >void shutdown(struct MsgPort *victim)
  35. >{
  36. >  FlushPort(victim);  /* Empty the queue (see func below) */
  37. >  RemPort(victim);  /* We're no longer public.. */
  38.  
  39. In between FlushPort() and RemPort() somebody could add new messages. You
  40. should be protecting yourself. safe sex ;^) :-)
  41.  
  42. >    // Amiga 3000   ___ \ Sam Hulick: shulick@indiana.edu (NeXTmail OK!)
  43.  
  44. While all of this doesn't help you right now, you should "fix" the code
  45. first and make it as "clean" and nice as possible. Then check the results
  46. again with mungwall and munglist.
  47.  
  48. --
  49. Heinz Wrobel, Edotronik GmbH (ECG018)
  50. FAX +49 89 850 51 25 / TEL +49 89 850 25 20 (HOME!&VOICE, sometimes...)
  51. Path: cbmehq!cbmger!edohwg!heinz@cbmvax.commodore.com
  52. "It's good to have a mouse, it's faster if you can do without one..."
  53. "He who doesn't develop with an A2024 doesn't know about font independent
  54.  user interfaces..."
  55.