Render DeadLock



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/11/2006 at 20:22, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   9 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Hi all ...

    Now I'm trying to render in a thread and it's working fine ...
    But when I break the render using ESC key and try to stop the rendering thread using End function ... C4D stops responding ... So I think it's a deadlock situation ...
    In the help file ... it's said ...

    **
    void End(void)
    Ends the thread. This function will not return before the thread has completely stopped.
    Note: If the thread does not check for TestBreak() then this function will not return until the thread has finished work and you might get into a deadlock situation.
    **

    I surely check for TestBreak ... but I got a deadlock ...
    So how can I stop the thread?

    Thanks in adnvance ...
    Zaw Min Tun



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/11/2006 at 00:32, xxxxxxxx wrote:

    Try placing a breakpoint on TestBreak()==TRUE, to see if your code ever gets there.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/11/2006 at 19:41, xxxxxxxx wrote:

    Sure ...

    In thread's Main ...

    I check like this ...

    void myThread::Main(void)
    {
       while(IsRunning())
       {
          if(TestBreak())
            End();
       }
    }

    So we can assume that the thread has already ended after the break ...
    But after the redner has stopped because of the break or ESC ... I check if the thread is running using IsRunning ... I found that the thread is still running ...

    So I try to End it again and then I fall into a deadlock ... So now I don't try to End it again after the break ... The code is working ...
    But I'm still confused ...

    Thanks a lot for your concern ... Mikael ...

    Zaw Min Tun



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 23/11/2006 at 13:04, xxxxxxxx wrote:

    You should not call End() when TestBreak() returns TRUE, but simply exit your main function. Otherwise your loop will continue calling End() forever.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/11/2006 at 18:15, xxxxxxxx wrote:

    So what I should do is like below?

    void myThread::Main(void)
    {
       while(IsRunning())
       {
          if(TestBreak())
            return;
       }
    }

    I'll try it ...

    Thanks & regards
    Zaw Min Tun



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/11/2006 at 18:26, xxxxxxxx wrote:

    Wowwwww ...

    It's great ...
    Now it's working in the way I want ...
    No more memory leaks ... more stable ...
    Thanks a lot ... Mikael ...

    With best regards ...
    Zaw Min Tun


Log in to reply