Jump to content

Run 2 Function in parallel ?


tbaror
 Share

Recommended Posts

Hello All,

I am looking for a way run 2 or more function in parallel, is there a way to achieve that

Thanks

Not really. Not with AutoIt.

Using AdLib methods like jebus495 suggested allows you to repeatedly call a function interrupting whatever function was being executed at the time, but that is not the same as running 2 functions in parallel.

It depends on what you want to do but you could write a function to do more than one thing at a time or you could run a separate process.

Also search for coprocessor to find some other options.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

This is the kind of thing that threads are used for. Right now, AutoIt does not support multi-threading scripts. That may change in the future (requires major rethink and rewrite to make work, so do not hold your breath), but for now AutoIt is single threaded. Maybe we can work around it.

First, ask yourself why you need two execution streams through the script? Can it be combined in one function? Can it be run sequentially? Can you break one function into smaller pieces and intersperse calls to the pieces with calls to the other function(s)? Maybe distil the essence of each function and call them alternatively from a timer function? Do any of these ideas work for you?

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Link to comment
Share on other sites

tanks all for you're answers

in fact what i am trying to achieve ,i am writing a script that check storage (nas) access latency by simple file size request ,in the same time i want to tcp port ping in parallel.

that way if latency will occurs which its does i have already wrote such kind of script only that i want to add the tcp ping function, that way i can determine/assume network issue or storage.

any suggestion will be nice.

Thanks

Edited by tbaror
Link to comment
Share on other sites

Run two different processes. Start one program that then calls the other using Run( ). You can establish a semaphore between the two programs so they stay connected.

David Nuttall
Nuttall Computer Consulting

An Aquarius born during the Age of Aquarius

AutoIt allows me to re-invent the wheel so much faster.

I'm off to write a wizard, a wonderful wizard of odd...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...