How to make an app - Andromo App Maker

Announcement

Collapse
No announcement yet.

Multi Thread

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multi Thread


    Hi, I wanted to run a command line process that runs and does not hang in the thread
    I already used the plugin and did not respond and crash Please help me very need

  • #2
    Hi , Welcome to the forums
    Please explain, we are not mind readers
    What command are you trying to run? Please an example of your code

    Comment


    • #3

      this is example I want to run your multi thread project and do not use the plugin because it has a bug plugin and crash program and not working buuton Android ADB Project2.zip

      Comment


      • #4
        I do not use this device but assuming you have the drivers installed you can try something like this ...

        Code:
        File.Run ("adb.exe", "install" C: //apk path//myapp.apk "")

        Comment


        • #5
          iwant run to multi thread and need log

          Comment


          • #6
            I also have not used this [commandline application] but maybe try -
            adb -e install -r abc.apk
            adb -d install -r abc.apk
            adb logcat | FINDSTR “msg for filter"

            webpage : http://www.albertgao.xyz/2016/12/13/...watch-its-log/

            Comment


            • #7
              Originally posted by milad0382 View Post
              this is example I want to run your multi thread project and do not use the plugin because it has a bug plugin and crash program and not working buuton
              The CommandLine plugin does not have a bug. It's actually your code which is buggy and which is causing your application to hang. Firstly, the string currently being returned to your Command variable is:
              Code:
              _SourceFolder.."\\AutoPlay\\Docs\\adb\\adb.exe install "MyFilePath\MyAndroidFile.apk"
              You're attempting a command line action here, so you'll need to omit those quote marks enclosing the filepath to your .apk file. Recode Line-8 so that it returns:
              Code:
              _SourceFolder.."\\AutoPlay\\Docs\\adb\\adb.exe install MyFilePath\MyAndroidFile.apk
              ... But first ensure your command line action is working as intended by checking it manually at the command prompt. We don't have a copy of the .apk file you're trying to install, nor do most of us currently have an Android device hooked up on which to test the apk package - so you'll have to check that first on your own. The command line action may need some restructuring (such as that which colc has indicated above). Test it manually at the command prompt to find out.

              The second issue is that at Line-10, you've instructed AMS to retrieve Paragraph info from your LastLog variable - but there is nowhere in your code indicating from where this variable is retrieving its data. CommandLine.Execute() pipes in an indexed table containing the following 3 values: StdOut, StdError & ExitCode. You've correctly instructed AMS to return the first indexed item back to the Paragraph object (ie. Result.StdOut) but have not coded in a source for the data from your LastLog variable. (And, keep in mind that the data from StdOut will get returned ONLY if your command string is correctly structured).

              Lastly, you say you require multi-threading? AMS is single-threaded only. So if you require multi-threading (for whatever reason), then you'll need to make use of either the MultiThread Object plugin (by LucasTheDuck) or LuaLanes (by Asko Kauppi).

              Comment


              • #8
                HI friends can you help for Multi thread how to run scrip in multi thread

                Comment


                • #9
                  As stated, for multi-threading you'll require the aforementioned plugin or the lua lanes module. Or you can use an approach something akin to multi-threading with co-routines (although this is not real multi-threading).

                  The attached example is a basic demonstration of how the MultiThread object plugin (Pabloko aka. LucasTheDuck) works. (Take note that it won't work with for loops).



                  Nb.
                  You can also use the SpawnerEx DLL to start additional threads without blocking your main application. See webultra's example here
                  Attached Files

                  Comment


                  • #10
                    Originally posted by BioHazard View Post
                    (Take note that it won't work with for loops).
                    For loops don't work in the MultiThread plugin? If that's the case and the MultiThread plugin really uses threads, it's not supporting loops because lua_lock and lua_unlock are not implemented in IR's build of Lua 5.1. If those are implemented, the Lua state will synchronise between threads - but become a bit slower.
                    Bas Groothedde
                    Imagine Programming :: Blog

                    AMS8 Plugins
                    IMXLH Compiler

                    Comment


                    • #11
                      Hmm, interesting. There's a link to the author's thread (external) on the demo attached above. Reference to the 'for loop' failure is made on the 3rd page of that thread and it seems the issue was never addressed.

                      I think Ulrich also had some kind of Multthread plugin out at some stage (which might be a better option) - though I can't see it on his website anymore. Anyone know whatever became of that plugin?

                      Comment


                      • #12
                        Hi BioHazard

                        Would you be so kind to check out this example I made? I compiled Lua 5.1.4 with an implementation of:
                        • lua_lock (using std::recursive_mutex)
                        • lua_unlock (using std::recursive_mutex)
                        • lua_cleanlock (releasing memory of mutex when thread is collected by Lua
                        • a module to create threads (function: thread(func, params): thread (userdata))
                        • a module to create mutexes (function: mutex(recursive = false): mutex (userdata))
                        • a custom implementation of type (checks __type metafield as well)
                        Run the application, you should see a marquee in an Input. Select a directory you want to calculate all CRC32 checksums of, choose recursive if you so desire (asked after folder selection). There are basically three of our own threads running in that example: the AMS main thread, the CRC32 thread (when it's busy) and the marquee thread.

                        The custom Lua dll is included in the .apz, however there are a few culprits with a version like this:
                        • Generally, the lua_lock/lua_unlock operations make the Lua engine slightly slower. For each protected operation (and there are a lot) it locks and unlocks the mutex.
                        • There is a lot you cannot do from outside the main thread. For example, there are a lot of GUI features that can only be done from the main thread (i.e. setting the title, changing the text in a Label). Inputs and ListBoxes work fine though.
                        • The Lua dll is larger
                        • I compiled this with the Windows 10 platform toolset, I'm not sure if this works on early versions of Windows - but that's a technicality.
                        • You either have to replace the Lua5.1.dll that AMS places in the build directory each time, or you replace Lua5.1.dll in AMS_Install_Dir/Data. Be sure to make a backup first!
                        Attached Files
                        Bas Groothedde
                        Imagine Programming :: Blog

                        AMS8 Plugins
                        IMXLH Compiler

                        Comment


                        • #13
                          Wow, you scare me IP. Your sensei powers seem to be growing by the day!

                          Exactly how much work would be involved to make this concept into a Multithread plugin which would be simple enough for beginners to get their heads around and use? Seems to be a need for one. But I guess the real question is how many users are actually left here to use it? And so would the effort required in making one even be worthwhile?

                          The marquee (even as a standalone idea) itself is a unique and interesting approach. Maybe you could even add a dedicated example using your method, here: https://forums.indigorose.com/forum/...-a-marque-text

                          Thank you for this amazing contribution.
                          Very cool.

                          Comment


                          • #14
                            Originally posted by BioHazard View Post
                            Exactly how much work would be involved to make this concept into a Multithread plugin which would be simple enough for beginners to get their heads around and use? Seems to be a need for one. But I guess the real question is how many users are actually left here to use it? And so would the effort required in making one even be worthwhile?
                            Not much at all, however it wouldn't be stable without the modified Lua version that synchronises the separate states. You'd get all kinds of bad things happening if it's just the plugin haha! (i.e. loops not working, but there's so much more that won't properly work then)
                            Bas Groothedde
                            Imagine Programming :: Blog

                            AMS8 Plugins
                            IMXLH Compiler

                            Comment


                            • #15
                              this is project not working in ams 8.5.2 how the problem ?

                              Comment

                              Working...
                              X