Dear All, Hi Paul, Fredrik, Threading - how to end a process
Dreading threading...
I want to make a vb.net exe that can handle different processing of files.
Example...
<info>
For this example we can say 3 Processes need to be continuosly done on 3 different set of files ( all files are comming to my server via ftp), but the amount of different processes is not a static value ie some weeks/days I might need to do 50 processes )
process 1 - any files found in folder 1 should be at given intervals grouped into one file and the output written to folder 2
Cycle time = 30 secounds
process 2 - any files found in folder 3 should be at given intervals grouped into one file and the output written to folder 4
Cycle time = 1 minute
process 3 - any files found in folder 5 should process to create one file for every line ( record ) found in the file(s) found and the output file(s) written to folder 6
Cycle time = 3 minutes
</info>
With this in mind I have so far created a windows exe that reads the required count of active processes to be run at start up from a table. The exe then reads per active process id a list of run time values found in a table matching the processid ( this all works fine ( using sql db as data base)). For each required process the exe start craetes a new class (a base class) that uses system.timers.timer object, the new class is started on it's own thread.
I can see so far everything is ok. but now I need to be able to from the exe main form be able to close / kill / stop the thread if a user decides to stop a certain process. All events are logged to the sql db under a logging class on it's own thread as well, so I'm also wondering, how would I be able to from a web page also stop the process thread cleanly.
In both instances of stopping the process I would like to check first if the process was busy formating files, if it was then I would like to be able to set a value so that the next time the timer elapses it checks to see if it should process or not.
The reason I wanted to use this threading technique is so that the exe just acts as a broker of the required processes. Also to note this application will be ported to Citrix so if any body sees any pit falls of the solution I would like them to say so.
?Should I just create x number of timers and have a single threaded solution? Any help very apprieciated as normal
Regards PaulSv: Threading - how to end a process
Take a look at this site:
http://docs.msdnaa.net/ark_new3.0/cd3/content/Type_Sample%20Applications.htm#title5_13
/Fredrik Normén NSQUARED2Sv: Threading - how to end a process
Thanks for site, I looked at the sample 'Killing a thread' only thins is it was in C# and my sytax and knowledge of the language is limited, you do not know of any VB.samples anywhere do you?
regards Paul