Information générale
Titre:
Has THREADING got something to do with this?
Dear All,
This is what I have done:
I created a table named COMMANDS with only one field named TASK. In it, I put some records with 'commands' such as:
1. SELECT TOP 1 FROM Testdata ORDER BY AMOUNT
2. WAIT WINDOW NOWAIT 'hi'
3. SELECT * FROM TestData WHERE ZIP='142343'
4. DO LOOPER (JUST LOOPS THRU A 100,000 RECORD TABLE)
5. WAIT WINDOW NOWAIT 'GOODBYE'
I purposedly alternated the records with commands that will take a while to finish and some which will finish faster.
I then created a form, put a timer control with interval of 1000. The timer event goes something like this:
************
SELECT Commands
if thisform.first && set to .T. initially
go top
thisform.first = .f.
else
? 'eof occurred at a bad place'
skip
endif
if eof()
this.enabled = .f. && disable this timer
? ' timer disabled '
else
? 'processing...'
thisform.execute( commands.task )
endif
*********************
The thisform.execute method goes something like this:
LPARAMETER lccommandtodo
&lccommandtodo
? lccommandtodo + ' finished...'
**********************
Upon running the form, the 'eof occurred at a bad place' message comes up after every task is executed.
These are my questions:
1. I was hoping that the 'faster' task could be finished first even if the earlier task is still being done. Is this what 'threading' is all about?
2. Why does the 'eof occurred at a bad place' occur? Is it because of the timer interval (too short)?
Thank you very much for any help.
Dennis
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement