Well, it’s a bit more of an issue than just “Can I sleep the main thread”. I’ve got a user who wants to print some stuff. The stuff is in an HTMLViewer, and rather than relying on the TitleChanged or StatusChanged events, which either don’t work on all platforms or are subject to data length restrictions, I wrote a websocket server which is incorporated into the app, but, perforce, it’s in a thread. I use it to communicate between the Xojo side and the HTMLViewer side. Other threads can send commands into the HTMLViewer which then responds with data. Evidently such threads are suspended while waiting for data to return.
Now, can I sleep or suspend the main thread? If so I can have the File->Print menu handler send a command via the websocket server to the HTMLViewer, wait for the data to return (sleep/suspend) then save or print it.
If I can’t sleep/suspend the main thread, I could send a different command to the websocket server, to have it do the printing, which involves putting up a Print dialog box. But wouldn’t this cause a ThreadAccessingUI Exception?