HISE Logo Forum
    • Categories
    • Register
    • Login

    Background execution of terminal scripts

    Scheduled Pinned Locked Moved Scripting
    14 Posts 3 Posters 354 Views
    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.
    • Christoph HartC
      Christoph Hart @aaronventure
      last edited by

      @aaronventure no idea, try it out :)

      I‘m fairly positive that you cannot run stuff as sudo but a shell / batch script should be executable with the correct command.

      A 1 Reply Last reply Reply Quote 1
      • A
        aaronventure @Christoph Hart
        last edited by

        @Christoph-Hart I'm creating the background task into a local variable in an inline function. Does the naming of the task matter? Can two of these run at the same time with the same name?

        Christoph HartC 1 Reply Last reply Reply Quote 0
        • Christoph HartC
          Christoph Hart @aaronventure
          last edited by

          I'm creating the background task into a local variable in an inline function.

          That will blow up in your face. Can't you define a background thread in the onInit? It sits around idle until you call callOnBackgroundThread(), but if it's a local variable then you'll get into lots of possible issues with the lifetime (it being destroyed while the thread is still active).

          A 2 Replies Last reply Reply Quote 0
          • A
            aaronventure @Christoph Hart
            last edited by

            @Christoph-Hart oh... it seems to be working fine at the moment, however i'm not referring to the locals inside the runProcess function, I'm just using them to create temporary background processes.

            what do you mean by "define a background thread"?

            d.healeyD 1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey @aaronventure
              last edited by

              @aaronventure I think he means this - https://docs.hise.audio/scripting/scripting-api/backgroundtask/index.html

              Libre Wave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              A 1 Reply Last reply Reply Quote 0
              • A
                aaronventure @d.healey
                last edited by

                @d-healey ah so just define it into const instead of a temporary local variable? I see now that's how the docs do it

                1 Reply Last reply Reply Quote 0
                • A
                  aaronventure @Christoph Hart
                  last edited by

                  @Christoph-Hart said in Background execution of terminal scripts:

                  That will blow up in your face.

                  Ah I get it now. It does result in another crash, though

                  521009df-845f-4fe9-8958-f947546260ee-image.png
                  20b8487a-2db3-4fd7-b72b-c95ac8121f9d-image.png

                  Christoph HartC 1 Reply Last reply Reply Quote 0
                  • Christoph HartC
                    Christoph Hart @aaronventure
                    last edited by

                    @aaronventure can you reliably reproduce this with a snippet? That looks like you‘re deleting a object on one thread while using it on another.

                    A 2 Replies Last reply Reply Quote 0
                    • A
                      aaronventure @Christoph Hart
                      last edited by

                      @Christoph-Hart no, not really, because the function executed first and then it crashed one second later.

                      I was creating the task inside the inline function in a local variable. As soon as I moved the createBackgorundTask call outside of the function and directly in on i it, crashing stopped. So, probably that was the object?

                      1 Reply Last reply Reply Quote 0
                      • A
                        aaronventure @Christoph Hart
                        last edited by

                        @Christoph-Hart could ! ! killing thread by force !! also tell me which thread is it killing? Like the task name that we give it upon creation?

                        Christoph HartC 1 Reply Last reply Reply Quote 0
                        • Christoph HartC
                          Christoph Hart @aaronventure
                          last edited by

                          @aaronventure you can easily do this as local change to find out what's happening:

                          Just search for the string in the HISE codebase and replace the line with

                          Logger::writeToLog ("!! killing thread by force !!" + getThreadName());
                          
                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          6

                          Online

                          1.7k

                          Users

                          11.8k

                          Topics

                          102.3k

                          Posts