Link to home
Start Free TrialLog in
Avatar of hibbidiji
hibbidiji

asked on

please help me thread my app.

I have an app that would VASTLY benefit from 30+ threads.   It is on one form.  I have a start and stop button that set "stopper" var.   While stopper is false, the app will fire one of 2 procedures.  These are nearly identical.    One uses one dataset (clientdataset1) and the other users 2 datasets (clientdataset1 and clientdataset2)  I will only be using one at a time and never in the same session.  I personally have never used threads and get severely confused when reading about them as the verbage is unfamiliar to me.  the issues that would seem to be tough are teh dataset access and the reporting of status to the main form.  

Please give as detailed an answer as you can, although I appreciate that this is not an easy question.

Andrew
Avatar of __alex
__alex

if the DataSet from the first thread is one of the DataSets in the second thread ... you have to use CriticalSection...
ASKER CERTIFIED SOLUTION
Avatar of Ivanov_G
Ivanov_G
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
1)DataSets

i think better way is to work with 3 datasets

thread A: clientdataset1A
thread B: clientdataset1B and clientdataset2B

this way you do not need to use critical sections

2)reporting of status to the main form

you can use
   PostMessage(MainForm.Handle, YOUR_MESSAGE, wParam, lParam)



Avatar of hibbidiji

ASKER

hard but not impossible. thanks!