i am creating a thread that will do some work and then enter those info in database.
use can abort that thread but i want to prevent that thread won't abort when it is inserting some thing in database, instead it will abort after that
i am creating a thread that will do some work and then enter those info in database.
use can abort that thread but i want to prevent that thread won't abort when it is inserting some thing in database, instead it will abort after that
preventing thread from abort at specfic stage
Kitek
1- I am performing some operations which at first i was running on a delegate but my functions uses some com libraries such as WebBrowser control which requires thread to run in Stat so i created a thread and set its state to Stat and assigned it to a delegate and after starting thread i joined it.
2- when user clicks on the Cancel button i am aborting that thread.
3- what i want to prevent is that when it is doing database operations it won't abort.
4- after completig those db operations it will abort.
what are suggestions now
formhabit
How does the user abort the thread - in the UI
sssmith03
Nomad Guru
Bwlee-Java
I would say use a delagated subroutine that you call periodically from the thread with the status of the thread. Or update a global variable (ugh.)
Mangix
AFAIK, later versions of access allow stored procs.
Really, you have all sorts of options, including just setting some boolean flags inside your threaded code. If it's possible for a thread to kill itself, I'd go with calling a method that sets a flag, and that flag causes the thread to kill itself when it leaves the current block of database code.
cdaniele
// as there is a constraint in my application reqs. not to use stored procedures.
I personally would argue that it should be a constraint that ALL DB access should be via stored procs. Can I ask why you have this constraint
// can i set and change thread state so that when i will try to abort i will first check what is the thread state
Well, one way or the other, the advice you've been given is your only real option, your constraints stop you from writing efficient code, so you need to set a flag somehow that you check before killing the thread.
Ettore
can i set and change thread state so that when i will try to abort i will first check what is the thread state
Carl Arnesten
which will call thread.abort.
Liz____9
Larry Rap
hi,
Is your problem solved
Thank you,
Bhanu.
JClishe
Jyri Hujanen
this is causing trouble.
about setting variable i have check in threading that thread.BeginCriticalState and thread.EndCriticalState vice versa, then what is it
Monia Anand
Why not disable/enabled the button at the appropriate times. If the button is disabled then they cant execute the button click event code containing the thread.abort command
Button1.enabled = false