While the information is correct, this practice can be dangerous now thatYou needn't hold the "pubscreen lock" for the duration that your window is opened. LockPubScreen() basically has the same effect as an open visitor window: it prevents the screen from being closed.
1) most programs can iconify their windows;
2) users can freely define their own "automatic" public screens using the Screens editor in Prefs.
To give an example: if a program opens on a user-defined public screen that is set to "Open/Close Automatically", the screen will get closed right after you iconify the program. The program then has nowhere to return, and naturally locks up the OS when you try to deiconify it.
The documentation, of course, says "for the duration that your window is opened". But I don't think it is made clear enough that you should keep the lock if you intend to allow your program to iconify. A warning of a situation like the above would be appropriate at least.