Hi,
I'm rewriting and optimizing my code (to work in multi-user environment) and ran into a problem:
How do I interrupt a thread?
I have two threads with basically a different method of getting the same result. So if one thread finishes and does have a proper result, I do not want to wait for the other one.
I used to have a Global for this which worked as a signal for the thread to goto to the ending (that is: close SQL statement, close SQL thread ; which HAVE to do done in the thread itself!).
I can use the same approach (a global) but now with the use of critical section but this will not enhance my throughput (which is what I'm trying to optimize!).
Is there a good way of doing this? I have been reading about Events that can be set using the handle of the thread, but this looks a bit difficult (for instance: how do you ensure it's signaled by the right thread). I can't find proper code on the forum so I'm hoping for something easier.
Hope someone can help a little
Sincerely
Jeroen
------------------
I'm rewriting and optimizing my code (to work in multi-user environment) and ran into a problem:
How do I interrupt a thread?
I have two threads with basically a different method of getting the same result. So if one thread finishes and does have a proper result, I do not want to wait for the other one.
I used to have a Global for this which worked as a signal for the thread to goto to the ending (that is: close SQL statement, close SQL thread ; which HAVE to do done in the thread itself!).
I can use the same approach (a global) but now with the use of critical section but this will not enhance my throughput (which is what I'm trying to optimize!).
Is there a good way of doing this? I have been reading about Events that can be set using the handle of the thread, but this looks a bit difficult (for instance: how do you ensure it's signaled by the right thread). I can't find proper code on the forum so I'm hoping for something easier.
Hope someone can help a little
Sincerely
Jeroen
------------------
Comment