Single Instance / Multithreading question



Hi there

I have what I believe must be a relatively simple question, but I
can't really find some help on google.

I have a single instance, Windows Form application, that takes some
arguments from a command line (some filenames) and then process these
files.

The problem is the following: when the application is launched, it
starts immediatly processing the file (so I could have used a console,
but consoles don't do single instancing). If other instances are
launched, they add the filenames to a queue through a
MyApplication_StartupNextInstance sub.

But processing the files takes time, and it seems that after a while
the "next instances" get bored of waiting for the process to be over
to execute and throw an error.

A solution I found is to launch the file processing in a separate
thread, so that the next instance can add their files to the queue at
the same time.

Where I am stuck is how can I get the process (running as a thread) to
launch when the file is processed some script that goes into the queue
and eventually re-ignite a new thread if there are still files waiting
to be processed.

If I was using a "thread.join" in the script that launches the
process, I am back to square 1, i.e. I have a non threaded sub
running, preventing new instances to add their files to the queue.

If I launch the script that launch the process from the process itself
then it's a sort of circular reference since the script wants to
terminate/start the process that runs it.

Am I missing something? Would someone know a way to get some script
running when the process is done, while not having a script listening
(and therefore preventing other scripts to run) at the same time?

thanks in advance!
Charles




.



Relevant Pages

  • RE: dealing with lengthy (time) query sets
    ... I would put the 'x' records into a QUEUE table. ... My last resort which i know works is to make another script that makes ... its own database connection does its work and dies. ... sender of the delivery error by replying to this message, or notify us by ...
    (perl.dbi.users)
  • Re: Processing workload distribution
    ... The Perl we're using is the 64 bit build of 5.8.8 from Activestate. ... I created a script that uses threads to launch a series of standalone ...
    (comp.lang.perl.misc)
  • Re: Is this group dying?
    ... application domain for the language is defined... ... I guess a script object could represent a task, ... single-producer/consumer unbounded wait-free queue which uses no ... The dispatcher queue schedules the tasks to ...
    (comp.programming.threads)
  • Error Sending To MSMQ queue from a Clustered SQL Server
    ... I had this simple task to do: "To have a trigger that sends a message to a queue under certain circunstances...". ... But when I try to migrate this solution to a clustered environment ... I tried to migrate this solution to a similar cluster environment, but with MSMQ installed on cluster instead of locally and still get the same error. ... The weard thing is that if I execute a DTS with an ActiveX Script Task which does the same as the script above. ...
    (microsoft.public.sqlserver.programming)
  • Re: MF Server rts32 does not run in AIX 5.3L batch queue
    ... I can't redirect output to /dev/null as the program running under the ... configuration of the queue device for the job queue. ... > If your script has a command like ...
    (comp.lang.cobol)

Quantcast