home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / amiga / programm / 18372 < prev    next >
Encoding:
Text File  |  1993-01-08  |  1.5 KB  |  50 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!ux1.cso.uiuc.edu!usenet.ucs.indiana.edu!navajo!shulick
  3. From: shulick@navajo.ucs.indiana.edu (Sam Hulick)
  4. Subject: Re: Enough talk.  FILE: server.c
  5. Message-ID: <C0JsA8.MIt@usenet.ucs.indiana.edu>
  6. Sender: news@usenet.ucs.indiana.edu (USENET News System)
  7. Nntp-Posting-Host: navajo.ucs.indiana.edu
  8. Organization: Vallen Software
  9. References: <C0IyF5.9Gv@usenet.ucs.indiana.edu> <38418@cbmvax.commodore.com>
  10. Date: Fri, 8 Jan 1993 18:20:31 GMT
  11. Lines: 37
  12.  
  13. So Forbid() should be used before creating new message ports, and
  14. finding them?  How's this revised version?
  15.  
  16. ....code....
  17.    Forbid();
  18.    myport = FindPort("Foobar!");
  19.    if (myport)
  20.    {
  21.       if (EasyRequest(NULL, &ereq[SERVER_RUNNING], NULL))
  22.       {
  23.          Permit();
  24.          shutdown(myport);
  25.       }
  26.       else
  27.       {
  28.          Permit();
  29.          CloseLibrary(GfxBase);
  30.          CloseLibrary(IntuitionBase);
  31.          exit(0);
  32.       }
  33.    }
  34.    if (!(myport = CreateMsgPort()))  /* Create the port.. */
  35.    {
  36.       Alert(AN_CreatePort);
  37.       exit(0);
  38.    }
  39.    Permit();
  40.  
  41. I'd put Permit() in shutdown(), but I'm afraid that if Forbid() wasn't
  42. called, it might crash?  Plus, do I need to Forbid() before doing
  43. DeleteMsgPort() and RemPort()?
  44.  
  45. -- 
  46.     // Amiga 3000   ___ \ Sam Hulick: shulick@indiana.edu (NeXTmail OK!)
  47.    // 68030 25 MHz /__/\ \ My opinions wear combat boots.  Or whatever.
  48. \\// OS 2.04       \__\/ / "Walk!  Not bloody likely.  I am going in a
  49.  \/                     / taxi."  --George Bernard Shaw
  50.