Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inject a function (queue like)
#1
Hi Gintaras, Hi all

I have a function built to process a file from Directory Opus (DO) file manager. The function is called from DO with the filename(s) as argument.

The function MyFunction begins with:

function str'&j
foreach _s j
...Do code with each file

1. How to "queue" a file if the function is already running. For instance I launched MyFunction with three files to process,
and I want to add one as the function is already busy.

2. How to launch several instances of MyFunction in the same time. At the time being, only one instance is allowed to run.

Thanks
#2
How the function is called from DO? If command line, what commandline used?
#3
"C:\Program Files (x86)\Quick Macros\qm.exe" M "Fichiers_depuis_DO" A "{allfilepath$}" "1"
#4
QM allows to run multiple function instances. Now I tested, it works with command line too.
Look in Properties -> Function properties.
Or maybe your function locks the file and DO then waits and does not run the function again.
Test multiple instances not from DO. For example create 2 shortcuts.
Also try to replace qm.exe to qmcl.exe. Maybe DO waits until QM process exits.
#5
Ok for the function property, forgot that one.

What about implementing a queue? How to do it?
#6
At the beginning insert

lock

Then next thread will wait until previous thread leaves the locked code. Will be sequential execution instead of parallel.

But the number of threads is limited to 500 or 1000, don't remember. If will be many waiting threads, will need a queue, more work.
#7
OK, sequential is good as long as I can add more than one file in successive calls.

Forget the queue if too much work, sequential is the same then for me.

Must I use lock- at the end of the function, and if so, where to put it exactly? Last line of function code?
#8
With lock, files will be processed in random order. If need FIFO order, will need a queue.

lock- is not necessary.
#9
FIFO is not needed, as I only need the job done, whatever the order of files processed.
Ok for lock not needed.

TY Gintaras.

BTW, you did not answered a word on this topic: http://www.quickmacros.com/forum/showthr...p?tid=4971

Guess you missed it....


Forum Jump:


Users browsing this thread: 4 Guest(s)