vinemicros
Programmer
I had a very odd problem the other day, that I solved, but it's raised some rather nasty questions.
The problem was that I had a nice grid, with some fields in the grid calling a text decryption function ('decrypt') in my main procedure file (utility.prg). Users could then double click on a record in this grid, and view and edit the record. This form that allows the viewing/editing also calls the decrypt function.
The problem was that now and then the two would clash - ie. the user double-clicks the grid record, and whilst the form displaying this data is calling the decrypt function in order to display decrypted data, the grid in the background refreshes itself and also calls the decrypt function - *whilst* the first decrypt function is performing the form's decryption!
This would have been okay, but my decryption function uses the random number generator with a seed value. With the second call of the decrpytion routine, the seed is reset. When this second call ends, the first resumes, with of course completely the wrong random number sequence - leading to unintelligible data.
I sorted this out by adding a flag to tell the grid that the decrypt function was busy.
HOWEVER, what else is going on in Visual Foxpro (SP5) that could cause such multi-tasking?
I have lots of forms and grids with their own datasessions and file locks. I also have a list of very strange problems like 'Record not locked' even when I *know* the record *is* locked. These errors can't be reproduced, and I can only presume it's because some other multi-tasking 'feature' is getting datasessions and databases all confused.
Is there a way to turn off such multi-tasking in FoxPro?
Am I going to have to write all my code knowing that at *any* point in the code another piece of code could be run (eg. to refresh something)?
The problem was that I had a nice grid, with some fields in the grid calling a text decryption function ('decrypt') in my main procedure file (utility.prg). Users could then double click on a record in this grid, and view and edit the record. This form that allows the viewing/editing also calls the decrypt function.
The problem was that now and then the two would clash - ie. the user double-clicks the grid record, and whilst the form displaying this data is calling the decrypt function in order to display decrypted data, the grid in the background refreshes itself and also calls the decrypt function - *whilst* the first decrypt function is performing the form's decryption!
This would have been okay, but my decryption function uses the random number generator with a seed value. With the second call of the decrpytion routine, the seed is reset. When this second call ends, the first resumes, with of course completely the wrong random number sequence - leading to unintelligible data.
I sorted this out by adding a flag to tell the grid that the decrypt function was busy.
HOWEVER, what else is going on in Visual Foxpro (SP5) that could cause such multi-tasking?
I have lots of forms and grids with their own datasessions and file locks. I also have a list of very strange problems like 'Record not locked' even when I *know* the record *is* locked. These errors can't be reproduced, and I can only presume it's because some other multi-tasking 'feature' is getting datasessions and databases all confused.
Is there a way to turn off such multi-tasking in FoxPro?
Am I going to have to write all my code knowing that at *any* point in the code another piece of code could be run (eg. to refresh something)?