On 20/07/2016 at 10:56, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R17
Platform: Windows ;
Language(s) : C++ ;
---------
Hello.
I have a GeDialog that is supposed to be unique. A command plugin allocates a global variable and no further instances will be created in the whole code.
The problem comes when I want different threads to access its Data container (only Get methods).
The main thread gets the values correctly, but the other threads get wrong values.
I try to deal with this problem by using the volatile keyword.
I know that I have to use mutex in a later stage but for now I get compile errors.
Here is a very simplified version of the code:
volatile MyGeDialog* any_dialog;
void callGet() {
Int32 val;
any_dialog->GetInt32(123123, val);
}
I get the following error which is caused when the volatile keyword is used:
no instance of overloaded function "MyGeDialog::GetInt32" matches the argument list and object (the object has type qualifiers that prevent a match)
argument types are: (int, Int32)
object type is: volatile MyGeDialog
Thank you for your time.