home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / amiga / programm / 17582 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.8 KB

  1. Path: sparky!uunet!cbmvax!peter
  2. From: peter@cbmvax.commodore.com (Peter Cherna)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Screen lists & locking
  5. Message-ID: <37995@cbmvax.commodore.com>
  6. Date: 17 Dec 92 15:54:41 GMT
  7. References: <ByywFv.Mzx@fc.hp.com> <37878@cbmvax.commodore.com> <dUH8s*N82@swinjm.adsp.sub.org>
  8. Reply-To: peter@cbmvax.commodore.com (Peter Cherna)
  9. Organization: Commodore-Amiga, Inc.  West Chester, PA.
  10. Lines: 41
  11.  
  12. In article <dUH8s*N82@swinjm.adsp.sub.org> forgeas@swinjm.adsp.sub.org (Jean-Michel Forgeas) writes:
  13. >In article <37878@cbmvax.commodore.com>, Peter Cherna writes:
  14. >
  15. >>       list = LockPubScreenList();
  16. >>
  17. >>       /* Now find the node */
  18. >>       strcpy( mybuffer, node->ln_Name );
  19. >>
  20. >>       UnlockPubScreenList();
  21. >>
  22. >>       /* This happens outside LockPubScreenList().  Also, there
  23. >>        * is no need to LockPubScreen() first.
  24. >>        */
  25. >>       SetDefaultPubScreen(node->ln_Name);
  26. >
  27. >In the example above, can the screen (called node->ln_Name) be closed
  28. >just after UnlockPubScreenList() and just before SetDefaultPubScreen(),
  29. >so that SetDefaultPubScreen(node->ln_Name) could fail?
  30.  
  31. Of course SetDefaultPubScreen() can fail, but it's safe to call it
  32. with the name of a screen that's vanished.  If you want to know if
  33. it'll fail, replace the call to SetDefaultPubScreen() with a sequence
  34. of:
  35.  
  36.     if ( LockPubScreen( mybuffer ) )
  37.     {
  38.         SetDefaultPubScreen( mybuffer );
  39.         UnlockPubScreen( mybuffer, NULL );
  40.     }
  41.  
  42. Note that the original code I posted had an error.  The call to
  43. SetDefaultPubScreen() should have had mybuffer as its parameter.
  44.  
  45. >    Jean-Michel
  46.  
  47.      Peter
  48. --
  49. Peter Cherna, User Interface Development Group, Commodore-Amiga, Inc.
  50. {uunet|rutgers}!cbmvax!peter    peter@cbmvax.commodore.com
  51. My opinions do not necessarily represent the opinions of my employer.
  52. "Opinions enlarged to show detail"
  53.