Single Instance / Multithreading question
- From: Charles <spam@xxxxxxxxxxx>
- Date: Wed, 24 Dec 2008 08:16:47 -0800 (PST)
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
.
- Prev by Date: Re: Help with PDF
- Next by Date: Re: Merry Christmas
- Previous by thread: Merry Christmas
- Next by thread: CheckListBox adding items
- Index(es):
Relevant Pages
|