R20 equivalent of GeSignal



  • Hello.

    In Cinema 4D R19, I was using GeSignal instead of while/GeSleep to "wake up" a thread.
    Which is the equivalent in maxon API ?

    Thank you.



  • Hello,

    to "wake" a thread one should use a condition variable. You find information in the Condition Variables Manual. General information on threading with the MAXON API is found here: MAXON API Threading.

    best wishes,
    Sebastian



  • Hello and thank you very much for the help.

    It appears that I cannot use it in a custom thread that inherits C4DThread.
    I have a private member maxon::ConditionVariableRef, but the following call fails compilation:
    condition = maxon::ConditionVariableRef::Create();

    Do I have to use it only in a thread inheriting maxon::ThreadInterfaceTemplate<ExampleThread> ?

    Thank you.



  • @peterakos said in R20 equivalent of GeSignal:

    I have a private member maxon::ConditionVariableRef, but the following call fails compilation:
    condition = maxon::ConditionVariableRef::Create();

    Hello,

    what compilation error exactly do you get?



  • Hello.

    Here is the error:
    error C2679: binary '=': no operator found which takes a right-hand operand of type 'maxon::ResultMemTmaxon::ConditionVariableRef' (or there is no acceptable conversion)

    note: could be 'maxon::ConditionVariableInterface::Reference &maxon::ConditionVariableInterface::Reference::operator =(const maxon::ConditionVariableInterface::Reference &)'
    note: or 'maxon::ConditionVariableInterface::Reference &maxon::ConditionVariableInterface::Reference::operator =(maxon::ConditionVariableInterface::Reference &&)

    I have used it exactly as in ConditionVariable manual, but the thread is C4DThread instead of maxon::ThreadInterfaceTemplate<ExampleThread>.

    Thank you.



  • Hi Peterakos, thanks for following up.

    It seems that the issue you're reporting is related to the fact that you're not properly handling the result of the BaseRef::Create() with the usual error handling means.

    Please check Error handling in our the C++ API Documentation.

    Best, Riccardo



  • Hello.

    The problem was that I didn't add the definitions.

    iferr_scope;
    signal = maxon::ConditionVariableRef::Create() iferr_return;

    Thank you for your time and sorry for that :(


Log in to reply