Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Threading & job questions

    Cinema 4D SDK
    r20 r21 maxon api c++
    3
    6
    957
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • fwilleke80F
      fwilleke80
      last edited by fwilleke80

      Hello,

      Besides using ParallelFor() I have never had much to do with threading.

      On program startup, we check our web server for available updates of our plugin. At the moment, this is done in the main thread, hence blocking it and prolonging program startup time. Therefore, I want to move that into a separate thread. I looked into the SDK docs for inspiration, and found that Jobs might be what I need.

      Question 1: (solved already, my bad)
      Looking at the example for for FactorialJob (https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_threading_jobs.html#page_maxonapi_threading_jobs_job), I see that the constructor that takes the input data (maxon::UInt) must be marked with MAXON_IMPLICIT. This is the first thing not working for me:

      Screen Shot 2020-01-13 at 12.01.38.png

      I see MAXON_IMPLICIT is defined in apibase.h, but including the header does not change anything, the errors are still there.

      Question 2:
      In the documentation of JobCueueInterface, an example file called filterwhirl.cpp is mentioned, which I'd love to take a look at. Where can I find it? The article also mentions tutorials, which I could not find.

      Question 3:
      Our update check currently invokes a Python plugin for the actual HTTP request to our online REST API (called via CallCommand(), there are different reasons why we did it that way, it will have to remain this way for a while). Since in the Job Manual (https://developers.maxon.net/docs/cpp/2023_2/page_maxonapi_threading_jobs.html) it states explicitly: "Make sure that a job has no additional, hidden dependencies like for example executing parallelized code internally.", does this mean I cannot parallelize this at all?

      Seasoned programmer, but with greenhorn threading questions 😉
      I'm hoping to get some answers that will get me started without investing too much time into this.

      Thank you in advance & best greetings from Berlin,
      Frank

      www.frankwilleke.de
      Only asking personal code questions here.

      1 Reply Last reply Reply Quote 0
      • CairynC
        Cairyn
        last edited by

        well, as for Q1 you did write MAXON_IMPLICITE with an E at the end in your code, so the compiler doesn't know that...

        1 Reply Last reply Reply Quote 0
        • fwilleke80F
          fwilleke80
          last edited by

          Oh my god. the stupidest error.... 😵
          OK, question 1 solved already, thanks 😁

          www.frankwilleke.de
          Only asking personal code questions here.

          1 Reply Last reply Reply Quote 1
          • fwilleke80F
            fwilleke80
            last edited by fwilleke80

            Hm, and it seems my assumption in Question 3 is true. The Python Plugin called via CallCommand() is not executed (call returns immediately with no results). I'll look for another solution then.

            Question 2 remains valid, though 😉
            Example plugins that demonstrate the practical use of Jobs and Queues would be most welcome!

            Cheers,
            Frank

            www.frankwilleke.de
            Only asking personal code questions here.

            1 Reply Last reply Reply Quote 0
            • ManuelM
              Manuel
              last edited by Manuel

              Hello,

              Q2 :
              filterwhirl.cpp is a internal file you don't have access to it. And we don't have tutorials. (this comment will be removed to avoid confusion)

              Q3 :
              CallCommand should be use on the main thread, that's maybe why it's not working, you can use ExecuteOnMainThread in your job.

              Cheers,
              Manuel

              MAXON SDK Specialist

              MAXON Registered Developer

              1 Reply Last reply Reply Quote 0
              • ManuelM
                Manuel
                last edited by

                hello,

                wow sorry this went out of my scope.

                Anything to add or can we set this thread to solved ?

                Cheers,
                Manuel

                MAXON SDK Specialist

                MAXON Registered Developer

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post