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.

Reply via email to