Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
On 29/12/2015 at 06:15, xxxxxxxx wrote:
User Information: Cinema 4D Version: 15+ Platform: Windows ; Language(s) : C++ ;
--------- I got a GeUserArea with heavy calculations, what I want is to put these calculations in a thread. now the main questions: 1- is it safe to use a thread inside GeUserArea::InputEvent() function? this thread will call functions like GetInputState() , etc...
2- is it safe to call SendParentMessage(action) from a thread?
On 29/12/2015 at 08:06, xxxxxxxx wrote:
1. Yes, you can start a thread in InputEvent(). But that thread can not call GetInputState(). 2. No, all GUI related functions are restricted to the main thread. I think it would be possible to use SendParentMessage() to send custom messages to a dialog even from a thread, but you probably want to trigger a GUI message (eg. BFM_ACTION).
You should implement synchronized data exchange between your User Area and your thread (and of course the User Area should also synchronize it when reading the data). You can use EventAdd() or SpecialEventAdd() from a thread to queue a message and eventually receive it very soon in the main thread to update your GUI.
On 30/12/2015 at 10:22, xxxxxxxx wrote:
thanks Niklas, I will handle it.