The situation Kamen brought up is a bit scary since it sounds like it would be a bit tricky to track down, so I'll try something else.
The printf trick you mentioned is working, but for whatever reason, it's eating all my tab characters so it's breaking some formatting. Not a huge problem, but kind of annoying. The fact that it doesn't work in Debug is a bit of a pain too but not the end of the world. The timer event seems like the way to go, especially if we want to at least leave the door open for linux compatibility. Thanks guys! On Fri, Jul 6, 2012 at 1:15 PM, Luc-Eric Rousseau <luceri...@gmail.com>wrote: > I've never run into that myself (Softimage runs tons of stuff on > PostMessages and timers, including things like property page script > logic, the implementation of the printf rerouting to logmessage and > the history log itself). > > if your plug-in must work on linux, I guess you'd look at pushing your > logmessages through a plug-in that clears its queue on an XSI events > instead of this win32 stuff.... events like timers are fired in the > main ui thread as well. there doesn't seemt to be an idle event, > unfortunately > > On Fri, Jul 6, 2012 at 3:44 PM, Kamen Lilov <kamen.li...@chaosgroup.com> > wrote: > > On 7/6/2012 9:58 PM, Luc-Eric Rousseau wrote: > >> > >> The clean way to switch thread is to create a hidden window when your > >> plug-in is initialized. Plug-ins are loaded and initialized in the > >> main UI thread. > >> > >> Then, you use PostMessage() to your window in your worker thread to > >> get it to do something. When you catch the message in your window's > >> WindowProc, you'll be in the Main UI thread. > >> > > And when your hidden window receives your custom message, how would you > tell > > if it was pumped by the main - "idle" loop of the application, or from > > within the message loop of some modal dialog? > > > > When the latter happens, and you attempt to execute a script command, > > crashes and hangs occur. Been there, done that. >